• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to modify Grid Spacing ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to modify Grid Spacing ?


  • Subject: Re: How to modify Grid Spacing ?
  • From: "L. Lee" <email@hidden>
  • Date: Thu, 20 Dec 2012 10:55:44 -0600
  • Thread-topic: How to modify Grid Spacing ?

Aren't they referred to as iCons now?

But setting icon (iCon) size is desirable, as well.

Anyway, it appears that you don't have to use UI scripting to set grid spacing, as this script generated by Desktop Wrap illustrates.

(I really must find time to incorporate the disk listing that I demonstrated at Mac OS X Hints into Desktop Wrap so the sorting is more correct.)

-----

tell application "System Events"

tell process "Finder"

set screensize to size of first scroll area whose position is {0, 0}

end tell

end tell

set {_width, _height} to screensize

set firstcol_dist to 0.5 * 140

set iconcol_dist to ((_height - firstcol_dist) / 17)

set heightdistance to (_height - iconcol_dist)

set col1 to _width - firstcol_dist

set a to col1

set b to 52

tell application "Finder"

set disklist to ((every item of desktop) whose class is disk)

set itemlist to (every item of desktop) whose class is not disk

if "Kind" is in {"Name"} then

set desktoplist to sort itemlist by name

else if "Kind" is in {"Modification Date"} then

set desktoplist to sort itemlist by modification date

else if "Kind" is in {"Creation Date"} then

set desktoplist to sort itemlist by creation date

else if "Kind" is in {"Kind"} then

set desktoplist to sort itemlist by kind

end if

if 0 is 1 then

set desktoplist to reverse of itemlist

end if

set newlist to (disklist & desktoplist)

set this_item to 0

repeat with i from 1 to count of newlist

set this_item to this_item + 1

set diskcount to (count of disklist)

if this_item > diskcount then

set desktarg to (item (i - diskcount) of desktoplist)

else

set desktarg to (item i of disklist)

end if

if this_item / 17 = (this_item / 17 as integer) then

if this_item = 17 then

set a to col1 - 7

if this_item > diskcount then

set (desktop position of desktarg) to {a, b}

else

set (desktop position of item i) to {a, b}

end if

else

set a to ((_width - ((round (this_item / 17)) * (147))) + (firstcol_dist))

if b > heightdistance then

set b to iconcol_dist

else

set b to (b + iconcol_dist)

end if

if this_item > diskcount then

set (desktop position of desktarg) to {a, b}

else

set (desktop position of item i) to {a, b}

end if

end if

else if this_item / 17 is not (this_item / 17 as integer) then

if this_item < 17 then

set a to col1 - 7

if this_item > diskcount then

set (desktop position of desktarg) to {a, b}

else

set (desktop position of item i) to {a, b}

end if

if b > heightdistance then

set b to iconcol_dist

else

set b to (b + iconcol_dist)

end if

else if this_item = 17 then

set a to col1 - 7

if this_item > diskcount then

set (desktop position of desktarg) to {a, b}

else

set (desktop position of item i) to {a, b}

end if

else

set a to ((_width - ((round (this_item / 17) rounding up) * (147))) + (firstcol_dist))

if b > heightdistance - firstcol_dist then

set b to 52

else

set b to (b + iconcol_dist)

end if

if this_item > diskcount then

set (desktop position of desktarg) to {a, b}

else

set (desktop position of item i) to {a, b}

end if

end if

end if

end repeat

end tell


-----
Thanks,

Laine Lee

From: "koenig.yvan" <email@hidden>
Date: Thursday, December 20, 2012 10:36 AM
To: liste AppleScript US <email@hidden>
Subject: Re: How to modify Grid Spacing ?

Le 20/12/2012 à 16:27, "koenig.yvan" <email@hidden> a écrit :


Le 20/12/2012 à 10:54, koenig.yvan <email@hidden> a écrit :


Le 20/12/2012 à 09:42, emile.a.schwarz <email@hidden> a écrit :


Maybe this one is cleaner

activate application "Finder"
tell application "System Events" to tell application process "Finder"
if not (exists (first window whose subrole is "AXSystemFloatingWindow")) then
keystroke "j" using {command down}
repeat until exists (first window whose subrole is "AXSystemFloatingWindow")
delay 0.1
end repeat
end if
tell (first window whose subrole is "AXSystemFloatingWindow") to tell first group
get value of slider 2 # To get the value in use in a window using default spacing
set value of slider 2 to 54.0
end tell
end tell

Yvan KOENIG (VALLAURIS, France) jeudi 20 décembre 2012 10:48:29

Oops

Robert Poland was fair enough to tell me off thread that I triggered the wrong slider.
Slider 2 rules the icon size, not the icon spacing.

Here is a revised script which also take care to close the floating window if it was hidden on entry.

When I will have time available, I will add code checking the display mode in use and will switch to "icons mode" if it wasn't active on entry then will reset the original mode on exit.

Yvan KOENIG (VALLAURIS, France) jeudi 20 décembre 2012 16:26:31


Oops number 2

I forgot to paste the script.

activate application "Finder"
tell application "System Events" to tell application process "Finder"
if not (exists (first window whose subrole is "AXSystemFloatingWindow")) then
set needReset to true
keystroke "j" using {command down}
repeat until exists (first window whose subrole is "AXSystemFloatingWindow")
delay 0.1
end repeat
else
set needReset to false
end if
tell (first window whose subrole is "AXSystemFloatingWindow") to tell first group
# get value of slider 1 # To get the value in use in a window using default spacing
# set value of slider 1 to 50.0
end tell
# Hide the floating window if it was hidden on entry
if needReset then keystroke "j" using {command down}
end tell

Yvan KOENIG (VALLAURIS, France) jeudi 20 décembre 2012 16:40:17





_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to modify Grid Spacing ?
      • From: "koenig.yvan" <email@hidden>
References: 
 >Re: How to modify Grid Spacing ? (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: How to modify Grid Spacing ?
  • Next by Date: How do you know if the folder is Shared
  • Previous by thread: Re: How to modify Grid Spacing ?
  • Next by thread: Re: How to modify Grid Spacing ?
  • Index(es):
    • Date
    • Thread