Re: How to pick user selected files only from one folder?
Re: How to pick user selected files only from one folder?
- Subject: Re: How to pick user selected files only from one folder?
- From: Luther Fuller <email@hidden>
- Date: Fri, 13 Jan 2006 15:00:09 -0600
Erkki Pennanen asked ...
I should pick user selected files and process
them. The command "set sourceItems to the
selection" works fine, but it selects all files
also from other folders, too. I should restrict
the selection only to user selected files in a
spesific folder. The sentence "set sourceItems
to the selection of folder "Macintosh HD:xxx"
compiles but is giving error. Is there some way
to solve this? I have tried already "tell folder
.... end tell", but it doesn¥t work either.
I'm puzzled by this. As far as I know, 'the
selection' refers only to items selected at the
insertion point (frontmost window or desktop) and
ignores selected items in other folder windows.
At least I've never encountered a problem with
this. Perhaps the problem is 'display dialog
sourceItems as text'. 'the selection' is a list
of references (not aliases) and might not work in
a dialog.
FWIW - What I usually do is provide a dual Drag &
Drop and Select & Launch interfaces. Here's the
code ...
on run
my getFinderSelection() -- a list of aliases
tell me to open the result
end run ---------------------------------------------
on getFinderSelection()
tell application "Finder"
try
set selList to selection
-- selList is empty if launched by
double-clicking multiple selection
on error
return {}
end try
--
set listCount to (count items of selList)
if listCount = 0 then return {}
repeat with i from 1 to listCount
(item i of selList) as alias
set item i of selList to the result
end repeat
(* -- this code is specific to your needs.
if listCount = 1 then -- So you can't
double-click an alias file of this appl
if (item 1 of selList) = (path to me) as alias then return {}
if class of item (item 1 of selList) = alias file then return {}
end if
*)
return selList
end tell
end getFinderSelection ---------------------------------------
_______________________________________________
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