Hi, being relatively new to this scripting malarky, I imagine I’m making some noob error :rolleyes:. However, my searches thus far have not led me to any obvous conclusion. Thus here is my issue in the hope someone can point me in the right direction.
I’m attempting to setup a script (or multiple scripts) to attach files from several folders (Folder A, FolberB, etc) as soon as they hit the fodler and email them off via Mail. I had previously achieved this using the following:
on adding folder items to thefolder after receiving theAddedItems
repeat with eachitem in theAddedItems
set theSender to "me@mac.com"
set recipCommon to "me"
set recipAddress to "me@mac.com"
set msgText to "My Files"
tell application "Mail"
set newmessage to make new outgoing message with properties {subject:"My Files", content:msgText & return & return}
tell newmessage
set visible to true
set sender to theSender
make new to recipient with properties {name:recipCommon, address:recipAddress}
make new attachment with properties {file name:eachitem} at after the last paragraph
end tell
send newmessage
end tell
tell application "Finder"
move eachitem to "Macintosh HD:Users:admin:documents:myfiles:sent"
end tell
end repeat
end adding folder items to
The problem with this is that when applied to multiple fodlers, Mail doesn’t seem to be able to handle files arriving concurrently in the folders and only processes the FolderA script.
So given my current knowledge (or lack thereof), I thought it’d be easiest to have ascript move files from each folder into a “Processing” folder and have the Mail script above run from there. Here’s the move script:
on adding folder items to thefolder after receiving theAddedItems
repeat with eachitem in theAddedItems
tell application "Finder"
move eachitem to "Macintosh HD:Users:admin:documents:myfiles:processing"
end tell
end repeat
end adding folder items to
Great in theory. However, when files arrive in the “Processing” fodler, the script fails to recognise the file arrival and doesn’t trigger. It works fine when I drag files into the “Processing” folder myself - it just doesn’t work when a script moves it there.
So, I’ll keep working away at this but if anyone can help, that’d be greatly appreciated ![]()