Re: Choose from list problems
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