Re: Tiger Desktop Position of Disks
Re: Tiger Desktop Position of Disks
- Subject: Re: Tiger Desktop Position of Disks
- From: Christopher Nebel <email@hidden>
- Date: Thu, 14 Jul 2005 10:35:32 -0700
On Jul 14, 2005, at 7:10 AM, Laine Lee wrote:
On 7/14/05 1:28 AM, "Matthew Smith" <email@hidden> wrote:
Don't use the name of the disks to identify them. Instead ask the
finder for a list of disk objects.
tell application "Finder"
set diskList to every disk whose name is not "Network"
repeat with oneDisk in diskList
desktop position of oneDisk
end repeat
end tell
The results are the same. If two or more have the same name, this
script also gets the same desktop position for those although they
aren't actually in the same position on the desktop.
If you look at the result of the "every disk" expression, you'll see
the problem: the object specifiers that the Finder returns all
identify disks by name, so when you throw them back to the Finder,
colliding disk names will all get resolved to the same one. This is
easy to work around, but you have to be a little indirect:
tell application "Finder"
repeat with i from 1 to (count disks)
if name of disk i is not "Network"
desktop position of disk i
end
end
end
Notice how the script always refers to the disk by index. And I mean
*always* -- when I first wrote this, I accidentally brought the bug
right back again by saying "set d to disk i", which gives you a by-
name specifier, hence the bug again. If you feel the need to
abbreviate, saying "set d to a reference to disk i" will work.
--Chris Nebel
AppleScript and Automator Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden