Post

Replies

Boosts

Views

Activity

Reply to AppleScript zip-to-mail stops working
Okay! With a bit of fussing, it's working correctly now. However, I'm still getting those nag messages from Mojave about an application that wants to control Mail and then Finder. I have given the script the required privileges in the Automation pane of the Security and Privacy menu, but that doesn't seem to be enough. Does it need to appear Accessibility as well? I'm not sure if I want the script to "control my computer." The script will work but I have to click through the security warnings, both of them.
Apr ’20
Reply to AppleScript zip-to-mail stops working
The problem isn't the date. The date is correctly inserted into the outgoing mail. The problem is that the attachment no longer gets attached to the message. The script is short so I'll post the whole thing. The problem seems to be happening near the bottom. I've made a couple of change to anonymize the script (the parts in italic: my_name, etc.). ----set aFile to (choose file)set zipFilePath to fileZipper(aFile)--Handler to make .zip files (from file or folder path)on fileZipper(myFile) -- deal with folders if (myFile as text) ends with ":" then set {TIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {":"}} set myFile to (text items 1 thru -2 of (myFile as text) as text) set AppleScript's text item delimiters to TIDs end if set zipFile to (myFile & ".zip") as text try do shell script "/usr/bin/ditto -c -k -rsrc --keepParent " & (quoted form of (POSIX path of myFile)) & " " & (quoted form of (POSIX path of zipFile)) on error theError display dialog theError end try -- tell application "Finder" set shortname to name of file (zipFile) set theSubject to shortname & " enclosed -- " & (current date) as text set theBody to "Zip archive enclosed." set theName to "my_name" set theAddress to "my-email@gmail.com" set theSender to "firstname_lastname <me@myisp.com>" set theAttachment to POSIX path of zipFile tell application "Mail" set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return} tell newMessage -- Default is false. Determines whether the compose window will -- show on the screen or whether it will happen in the background. set visible to true set sender to theSender make new to recipient at end of to recipients with properties {name:theName, address:theAddress} tell content make new attachment with properties {file name:theAttachment} at before the last paragraph end tell end tell -- Bring the new compose window to the foreground, in all its glory activate send newMessage end tell end tell --the following line deletes the recently created zipFile do shell script "rm " & (quoted form of (POSIX path of zipFile))end fileZipper--end--If I run this and look at the log, I find the following: make new attachment with properties {file name:"/Users/robertb/Desktop/test-file.pdf.zip"} at before last paragraph of content of outgoing message id 4 --> missing value
Apr ’20
Reply to AppleScript zip-to-mail stops working
When I run this script, there appear to be a couple of errors in the log, maybe someone can help me resolve them. I'd be happy to post the entire code (it's a short script), but they are as follows:1. current date --> error number -100042. make new attachment with properties {file name:"/Users/robertb/Desktop/some_file.zip"} at before last paragraph of content of outgoing message id 4 --> missing valueThanks.
Apr ’20