Ok, so I have a folder actions setup that’s supposed to redirect all files that come into that folder of a certain type to a different folder. That part works fine, I just need to know how you figure out what files were added to the folder. My code is:
on adding folder items to this_folder
try
display dialog "JPG files will be forwarded to \"JPEG Files\"" with title "Finder" buttons {" Cancel ", " Ok "} default button 2
set theResult to result
if button returned of theResult = " Cancel " then
set errLine to 0
error
end if
repeat with i from 1 to (length of theDetectedItems)
set theName to ((item i of theDetectedItems) as string)
repeat
set errLine to 5
if ((offset of "." in theName) = 0) then exit repeat
set theName to text ((offset of "." in theName) + 1) thru end of theName
end repeat
if theName = "ipa" then
tell application "Finder"
move file (item i of theDetectedItems) to folder (((path to desktop as string) & "JPG Files:") as alias)
end tell
end if
end repeat
try
display dialog "File transfer success." with title "Finder" buttons {"Exit"} default button 1 giving up after 5
end try
on error
if errLine = 0 then
display dialog "File transfer canceled by user." with title "Finder" buttons {"Exit"} default button 1
else
--display dialog "File transfer canceled." with title "Error in code " buttons {"Exit"} default button 1
end if
end try
end adding folder items to
But theDetectedItems should be replaced with the variable that is whatever items were added. Anybody know what this variable is called?
Thanks!
PS: I looked in the Folder Actions Setup’s dictionary but it wasnt in there