I noticed that the latest version of Microsoft Office applications lost the ability to activate "Don't Save" button on Save dialog boxes with Command+D shortcut. Looks like they are complying with a rather long-term change in the MacOS to a new shortcut - Command+Delete. Well, I can't very well use that shortcut with my left hand which is really used to hitting Command+D by now, can I? Some googling revealed a solution. See https://osxdaily.com/2011/08/15/return-the-dont-save-keyboard-shortcut-to-commandd-in-mac-os-x-lion/ for details. Issue the following command in Terminal to get your Command+D back:
defaults write NSGlobalDomain NSSavePanelStandardDesktopShortcutOnly -bool YES
Voila, no need to retrain myself!
Thursday, February 20, 2020
Friday, January 3, 2020
Using AppleScript for a Complicated Apple Mail Rule
My son's daycare sends us an e-mail with a link to pictures they take of kids during the day. It's adorable. I like to forward this e-mail to both sets of grandparents. One small problem - he only goes there 3 days per week, but e-mails arrive daily. Mission - avoid spamming the grandparents. The daycare used to put the day of the week in the Subject line and that made it very easy to set up rules in the Mac Mail app to handle the automatic forwarding. Lately, all Subjects are the same. So, AppleScript to the rescue - forward the message only if it arrives on specified days of the week. Disclaimer - I do not know AppleScript. Not even a little bit. So it's a lot of Googling and trial and error to get these occasional scripting attempts of mine to work. Here's what I cobbled together:
Save the script to ~/Library/Application Scripts/com.apple.mail and set up a rule in Mail app with "Run AppleScript" action pointing to this script.
using terms from application "Mail"
on perform mail action with messages these_messages for rule theRule
repeat with eachMessage in these_messages
set theDate to the date received of eachMessage
set theWeekday to weekday of theDate
--display alert (theWeekday)
if theWeekday = Monday or theWeekday = Wednesday or theWeekday = Friday then
tell application "Mail"
set addressList to {"user1@yahoo.com", "user2@gmail.com"}
set theMessage to forward eachMessage --with opening window
tell theMessage
repeat with i from 1 to count addressList
make new to recipient at end of every to recipient with properties {address:item i of addressList}
end repeat
delete bcc recipients
delete cc recipients
end tell
send theMessage
end tell
end if
end repeat
end perform mail action with messages
end using terms from
Tidbits to note: the if statement checks whether the message was received on specific weekdays I am interested in; I had to use a list ("addressList") and subsequently iterate over it to accommodate multiple recipients.
Subscribe to:
Posts (Atom)