• 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: faulty logic, mine
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: faulty logic, mine


  • Subject: Re: faulty logic, mine
  • From: "email@hidden" <email@hidden>
  • Date: Wed, 16 Sep 2009 10:37:32 -0700

Try this:

tell application "Finder"
	set selt to selection
	log class of selt
	set spos to position of front window
	set spr0 to properties of item 1 of selt
end tell

What's happening is that finder is returning a list of items as the selection, even if only one thing is selected, so you must refer to the first item of the list.

You could also do this:

repeat with thisItem in selt
 set spr0 to properties thisItem
end repeat

You'll notice I added a log command to your script. If you open the apple event log in script editor before you run it, you'll see the class of the variable selt, plus more information about the selection, etc.

FWIW, the dictionary may not be the best place to start learning appleScript. There are sample scripts for the finder provided in the scripts menu and a few good books available.

HTH,

ES
_______________________________________________
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
References: 
 >faulty logic, mine (From: Tin Tin <email@hidden>)

  • Prev by Date: Re: Lost properties
  • Next by Date: Opening a Preference Pane by ID in a Localization-safe and 10.4-compatible Way
  • Previous by thread: faulty logic, mine
  • Next by thread: Re: faulty logic, mine
  • Index(es):
    • Date
    • Thread