External AppleScript won't run...

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

External AppleScript won't run... Sat Aug 05, 2023 3:05 am • by BradleyB
I have an embedded AppleScript that I have modified slightly after finding it online that works just fine. It attaches the .pdf file that is being processed to an email, and sends it to my bookkeeper. I have about 80 different Hazel rules though, and they will all require a script like this. In case my bookkeeper leaves me, I will be faced with having to redo all these rules. So, I decided I would try to call this AppleScript as an external .scpt file, but it doesn't work, and I am new at this, and don't really understand how to make this function....?

Here is the script:

set theAttachment1 to (POSIX path of theFile)
set subject_ to "Tax Notice Received for Review"
set the_content to "Hi Kyrie-

This Tax Item came in, and I have uploaded it to the Zoho Workdrive / Finance Team/Tax folder at this link: https://workdrive.zoho.com/home/32jsxa8 ... f2504f5ce1

1. Take a look at it to see if we need to take any action on it
2. Take whatever action is needed
3. File it appropriately in Zoho so we can find it again if necessary

Thank you

Brad : )

PS: Note that it may take a few minutes for this document to appear in Zoho Workdrive : ) "
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:subject_, content:the_content & return & return}
tell newMessage

set visible to false
set sender to "brad@blahblah.com"
make new to recipient at end of to recipients with properties {address:"kyrie@dblahblah.com"}
make new attachment with properties {file name:theAttachment1} at after the last paragraph

(* change save to send to send*)
send --<<<<---------------- change save to send to send or send to save to save to drafts
(* change save to send to send*)
end tell
end tell
BradleyB
 
Posts: 3
Joined: Sat Aug 05, 2023 2:52 am

Re: External AppleScript won't run... Mon Aug 07, 2023 8:38 am • by Mr_Noodle
If you have it as an external script, you need to use a specific handler. Check the manual as it's all described there.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support