Applescript for folder action stops working after I make a minor change?!


Joined
Nov 29, 2020
Messages
2
Reaction score
0
I have a folder action that runs an applescript. All it does is just grab the files in a folder and "embeds" the file in an email (i.e. embedding images inline in an email vs as an "attachment").

I've used it successfully for years and through different Mac OS versions (I'm currently still on Mojave).

But I tried to change the sent-to email address today, and the script stopped working. Now it'll open a new email. fill in the subject and recipient, but stops there.
It still doesn't work after I revert the change. I had to restore the applescript file from a backup to get it to work again.

Does anyone know why it would do this and how I can fix it?

Here's the script:

Code:
on adding folder items to thisFolder after receiving theseItems
    tell application "Mail" to activate
    repeat with thisItem in theseItems
        tell application "Finder" to set thisName to name of thisItem
        tell application "Mail"
            set theMessageBody to ""
            set theMessage to make new outgoing message with properties {subject:thisName, content:theMessageBody}
            tell theMessage
                make new to recipient with properties {name:"xyz", address:"[email protected]"}
                make new attachment with properties {file name:thisItem} at after the last word of the last paragraph
                delay 1
                send theMessage
            end tell
        end tell
    end repeat
end adding folder items to
 
Ad

Advertisements

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
9,316
Reaction score
378
Hello and welcome.

Sorry, I am not very experienced with AppleScript/Automator. Maybe another member with more experience will chime in, or you can try the folks over at MacScripter.

C
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top