• 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
Getting array of Item names and Positions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting array of Item names and Positions


  • Subject: Getting array of Item names and Positions
  • From: development2 <email@hidden>
  • Date: Mon, 28 Jan 2008 07:54:15 -0700

I hope this is the correct list for this. I will be in need of some Applescript help, as I have not done in any Applescript in over 10 years.

My current problem is, I need to find a way to get the file name and desktop position of all items on the desktop. I have this script which works (In a way):

tell application "Finder"
set names to name of items of desktop
set positions to desktop position of items of desktop
return {names, positions}
end tell

So what this does is it return an array of two items the first array item is an array of desktop item names, the second array item returns an array of desktop item positions. The problem is though that I can not guarantee that item 1 of the name array corresponds to item one of the position array.

{{"Macintosh HD", "Games", "Development"}, 1362, 55}, {1232, 325}, {1228, 423}}

What I am doing now from my Cocoa app is sending individual requests for the desktop position of Items I find in the users Desktop folder. This is very slow, to ask for each individually. So what I want to do is ask for them as a group as I did above. But I want to order them so the Item name and desktop position are paired up with each other. So for example like this:

{{"Macintosh HD",{1362, 55}},{"Games",{1232, 325}}, {"Development", {1228, 423}}}

So what I would like to do is have a script do something like this:

tell application "Finder"
set {names, positions} to name of items of desktop and desktop position of items of desktop
        set  NamesPos to {names, positions}
return NamesPos
end tell
(The above script is just an example, it does not really work)

So it would somehow come out like above with the Name and position pair. Can any one help with this. Also if you can think of a different way to do this please let me know.

Thanks in advance.

 _______________________________________________
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: Getting array of Item names and Positions
      • From: Michelle Steiner <email@hidden>
    • Re: Getting array of Item names and Positions
      • From: has <email@hidden>
    • Re: Getting array of Item names and Positions
      • From: Rob Stott <email@hidden>
    • Re: Getting array of Item names and Positions
      • From: Skeeve <email@hidden>
  • Prev by Date: Re: changing part of a string
  • Next by Date: Re: Getting array of Item names and Positions
  • Previous by thread: Is iCal slower?
  • Next by thread: Re: Getting array of Item names and Positions
  • Index(es):
    • Date
    • Thread