You are here: Home → Forum Home → The Mac Observer Forums → Design & Create → Thread
Simple code needed and I can't figure it out
-
I’ve got an applescript that runs as a Folder Action. It needs to test the files with an “If statement” so that it only runs on certain files.
on adding folder items to this_folder after receiving added_items
Heres the problem: ---> if added_items are (*.pdf files) then
(*
tell application "Terminal"
do script "bla bla bla; exit"
end tell
*)
end if
end adding folder items toI just don’t know the proper syntax to tell the script to only run if the file is a .pdf file.
Any help would be greatly appreciated.
Thanks!
-
I suggest the script should start like this:
on adding folder items to this_folder after receiving added_items
repeat with added_file in added_items
set fileName to name of added_file
if fileName ends with ".pdf" thenAnd continue on from there. I think that should work based on some things I found around the internet, but I generally don’t use AppleScript and haven’t tested it. I am, however, a software engineer professionally, so I’m making an educated guess.
Good luck.

Signature
According to statistics, half the world is below average intelligence
"The power of accurate observation is commonly called cynicism by those who have not got it."-George Bernard Shaw
"You can’t change that by gettin’ all…bendy." -
That doesn’t work
Thank you but, I tried that and all sorts of variations and can’t get any of them to work.
Anyone have any other suggestions?

