Re: How to get icon size of desktop icons
Re: How to get icon size of desktop icons
- Subject: Re: How to get icon size of desktop icons
- From: Mr Tea <email@hidden>
- Date: Sat, 06 Dec 2003 18:30:09 +0000
This from Stephen Lanza - dated 5/12/03 11.05 pm:
>
Using the Script Debugger explorer, it looks like there is no icon view
>
options for the desktop as there is for regular finder windows.
>
>
Is it possible to get and set these values?
AFAIK, no, or at least, not easily. You can get these values by accessing
the Finder's pList file, in a rough sort of a way, as this script adapted
from Paul Skinner's handler for getting the bounds of the desktop shows:
--===========================================================
DesktopOptions()
on DesktopOptions()
try
set plistText to read file ((((path to preferences from user domain)
as text) & "com.apple.finder.plist") as text)
set my text item delimiters to "DesktopViewOptions"
set plistText to text item 2 of plistText
set my text item delimiters to "<dict>"
set plistText to text item 2 of plistText
set output to {}
repeat with thisDelimiter in {"<key>ArrangeBy</key>",
"<key>IconSize</key>", "<key>FontSize</key>"}
set AppleScript's text item delimiters to thisDelimiter
set datatext to text item 2 of plistText
set AppleScript's text item delimiters to ">"
set datatext to text item 2 of datatext
set AppleScript's text item delimiters to "<"
set datatext to text item 1 of datatext
set the end of output to datatext
end repeat
set my text item delimiters to ""
return the output
on error errorMessage number errorNumber partial result errorResult
from errorFrom to ErrorTo
set my text item delimiters to ""
set errorMessage to ("The " & (class of DesktopOptions) & " '" &
"DesktopOptions" & "' generated an error." & return & the errorMessage) as
text
error errorMessage number errorNumber partial result errorResult from
errorFrom to ErrorTo
end try
end DesktopOptions
--===========================================================
(Any lines that abut the left margin of the message window have been wrapped
and should be re-connected to the end of the previous line.)
This example will get you the arrangement method, icon size and text size.
As for setting these values, I guess you could write to the file, but you'd
probably have to quit the Finder first, then relaunch it, which seems a bit
extreme.
None of this gets any nearer to being able to position icons on the desktop
with a script, which may well be the Holy Grail of OS X Finder scripting. I
don't even know where to find the preference info about what's displayed
where on the desktop (although perhaps someone reading this knows...?)
Cordially,
Nick
pp Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.