You can coerce selection to a list with ‘selection as list’. You can set it to a variable with ‘set the_selection to selection’. Since its not a list you can count it by saying what you want to count with ‘count items of selection’.
While not disagreeing for a moment with what Rob and kel have said I would suggest two things.
1. Use a variable rather than ‘selection’;
2. Use Akua’s “the entries in” and dispense with the Finder. i.e. set pdfFiles to (the entries in whose names match etc (NOT in a “tell Finder” loop).
You will have to mess about a bit with the whose names match, but I would think it well worth the effort.
Why are you selecting the files?
wouldn’t set pdf_list to files in folder pdfsourceFolder whose name contains PubDate and name contains “PDF”
work as well? then you check if pdf_list was empty or not. If you’re only moving the files the finder command move takes a list as an argument and will move every item in the list (on my version of applescript)
Hi everybody,
Here’s an article on the subject:
http://www.applescriptsourcebook.com/tips/gotchas/variablesandproperties.html
Reference forms are wierd huh? This doesn’t work also:
tell application “Finder”
if (every item of folder “Test Folder” of desktop) is {} then
beep 3
else
say “What’s happening? Test Folder is empty”
end if end tell
Hope this has cleared it up for you as it has me, Kel.