• 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: Choose from list problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Choose from list problems


  • Subject: Re: Choose from list problems
  • From: KOENIG Yvan <email@hidden>
  • Date: Mon, 17 Dec 2007 11:10:48 +0100


Le 17 déc. 07 à 07:38, Peter Baxter a écrit :

HI People,

set thisWindow to (choose folder)
try
set chosenFiles to (every file in thisWindow whose name contains ".pdf")
set thisList to (choose from list chosenFiles with prompt "Use Apple key to choose multiple items" with multiple selections allowed)
my runScript()
on error the_error
display dialog "Error: " & the_error
end try



In fact two things are wrong.

-- 1  --
the instruction
set chosenFiles to (every file in thisWindow whose name contains ".pdf")
use a command belonging to the Finder so you must "speak" to the Finder.

tell application "Finder" to set chosenFiles to (every file in thisWindow whose name contains ".pdf")

-- 2 --
the same instruction returns a list of "file descriptor" of this kind.
document file "AppleScriptX.pdf" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk of application "Finder"


Such objects can't be used in Choose from list
A way to get rid of the problem is to code:

tell application "Finder" to set chosenFiles to (every file in thisWindow whose name contains ".pdf")

repeat with i from 1 to count of chosenFiles
	set (chosenFiles's item i) to (chosenFiles's item i) as text
end repeat

Yvan KOENIG _______________________________________________
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: 
 >Choose from list problems (From: Peter Baxter <email@hidden>)

  • Prev by Date: Re: Choose from list problems
  • Next by Date: Re: Choose from list problems
  • Previous by thread: Re: Choose from list problems
  • Next by thread: Mail questions.
  • Index(es):
    • Date
    • Thread