jneug / osx-script-stuff Goto Github PK
View Code? Open in Web Editor NEWVarious scripts I use to automate my mac
Various scripts I use to automate my mac
Great script, it gave me a good starting point. But I wanted to let you know that it will not work if you have spaces in the file path or the file name.
I couldn't get it to work with spaces in the path names or file names. I'm a AppleScript noob. But here's what I came up with to fix it.
property DOWNLOADS : "/Users/username/Attachments Pre-sort"
on processMessage(theMessage)
try
tell application "Airmail 3"
repeat with anAttach in mail attachments of theMessage
set aFilename to filename of anAttach
set aFile to quoted form of aFilename
set fldr to quoted form of DOWNLOADS
do shell script "cp " & aFile & space & fldr
end repeat
end tell
end try
end processMessage
Many thanks for this.
In order to work properly, though, the "Download Attachments" checkbox must be set in the account settings.
I wonder if there is a way for the script to instruct Airmail to actually download the attachments, so that this way only the attachments of messages that meet rule criteria were downloaded.
I was trying to use your script but it doesn't work in MacOs High Sierra. Do you have a script that works. I am trying to get my PDF attachments to download when the new mail arrives. I have created the rule, just looking for a working AppleScript.
I saw you were doing some airmail scripting, and I was wondering if you would know how to have applescript click the "Markdown" feature in the compose window. In return I'll share my script that allows me to send a vim buffer to a new email:
#!/bin/bash
# in vim do: :w !~/airscript.sh
osascript 3<&0 <<'APPLESCRIPT'
on run argv
set stdin to do shell script "cat 0<&3"
tell application "Airmail 3" to activate
tell application "System Events"
tell process "Airmail 3" to click menu item "New Message" of menu "File" of menu bar 1
delay .4
-- Below does not work:
-- tell process "Airmail 3" to click link "Markdown" of window 1 of window 1
keystroke tab
keystroke tab
keystroke tab
keystroke tab
keystroke tab
keystroke stdin
end tell
end run
APPLESCRIPT
#osascript 3<&0 airmail.as
The script only downloads the first attachment and ignores the rest.
Is there any way of changing this behavior? :)
Airmail 3.5.6
OS 10.13.4
SaveAttachment.applescript:
I had to use repeat with anAttach in mail attachments of theMessage
(plural) otherwise it didn't work for me (Airmail 3.2.7)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.