• 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: Tiger Desktop Position of Disks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Tiger Desktop Position of Disks (From: Laine Lee <email@hidden>)

  • Prev by Date: Re: Disk or Volume path help needed
  • Next by Date: Re: rendering HTML on the fly with Webkit
  • Previous by thread: Re: Tiger Desktop Position of Disks
  • Next by thread: 10.4.2 does not correct some found bugs Where to report them ?
  • Index(es):
    • Date
    • Thread