Skip to content

Instantly share code, notes, and snippets.

View benwaldie's full-sized avatar

Ben Waldie benwaldie

View GitHub Profile
@benwaldie
benwaldie / 2013-01-27-TUAW_Waldie.plist
Created January 28, 2013 02:39
TUAW > Evernote > Scale Embedded Images Plist
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>jpg</string>
<string>jpeg</string>
<string>png</string>
<string>tif</string>
<string>tiff</string>
@benwaldie
benwaldie / 2013-02-03-TUAW_Waldie-1.applescript
Last active December 12, 2015 03:08
TUAW > AppleScripting Notification Center > Scheduling Do Not Disturb > Enable Do Not Disturb
do shell script "defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean true"
set theDate to quoted form of (do shell script "date -u +\"%Y-%m-%d %H:%M:%S +0000\"")
do shell script "defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturbDate -date " & theDate
do shell script "killall NotificationCenter"
@benwaldie
benwaldie / 2013-02-03-TUAW_Waldie-2.applescript
Last active December 12, 2015 03:09
TUAW > AppleScripting Notification Center > Scheduling Do Not Disturb > Disable Do Not Disturb
do shell script "defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean false"
try
do shell script "defaults -currentHost delete ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturbDate"
end try
do shell script "killall NotificationCenter"
@benwaldie
benwaldie / 2013-02-15-TUAW_Waldie.applescript
Created February 16, 2013 04:53
TUAW > AppleScripting OmniFocus > Send Completed Task Report to Evernote
-- Prepare a name for the new note
set theNoteName to "OmniFocus Completed Task Report"
-- Prompt the user to choose a scope for the report
activate
set theReportScope to choose from list {"Today", "Yesterday", "This Week", "Last Week", "This Month"} default items {"Yesterday"} with prompt "Generate a report for:" with title "OmniFocus Completed Task Report"
if theReportScope = false then return
set theReportScope to item 1 of theReportScope
-- Calculate the task start and end dates, based on the specified scope
@benwaldie
benwaldie / 2013-02-24-TUAW_Waldie-1.applescript
Created February 24, 2013 20:33
TUAW > AppleScript > Generate OmniFocus Email Followups from Contacts
-- "using terms from" is necessary to let AppleScript know that these event handlers are terminology that belongs to the Contacts app.
using terms from application "Contacts"
-- This handler returns the Contacts property for which the plug-in should function.
on action property
return "email"
end action property
-- This handler returns the name of the plug-in to be displayed in the Contacts property popup menu.
on action title
@benwaldie
benwaldie / 2013-02-24-TUAW_Waldie-2.applescript
Created February 24, 2013 20:39
TUAW > AppleScript > Generate OmniFocus Phone Followups from Contacts
-- "using terms from" is necessary to let AppleScript know that these event handlers are terminology that belongs to the Contacts app.
using terms from application "Contacts"
-- This handler returns the Contacts property for which the plug-in should function.
on action property
return "phone"
end action property
-- This handler returns the name of the plug-in to be displayed in the Contacts property popup menu.
on action title
@benwaldie
benwaldie / 2013-03-17-TUAW_Waldie.applescript
Created March 18, 2013 01:34
TUAW > Triggering AppleScripts from Calendar Alerts in Mountain Lion
-- This property controls the calendar on which the event is added
set theCalendarName to "AppleScripts"
-- Prompt the user to select a script to attach to an event. This should be an application.
set theScriptToTrigger to choose file with prompt "Please select a saved AppleScript application to attach to an event:" of type "app"
-- Get the script's name
set theScriptToTriggerName to displayed name of (info for theScriptToTrigger)
-- Check for the existence of the target calendar, creating it if it doesn't already exist
@benwaldie
benwaldie / 2013-03-22-TUAW_Waldie.applescript
Last active December 15, 2015 07:19
TUAW > AppleScripting Mail > Announce New Emails By Voice
-- Options to process a maximum number of messages
property limitMessageProcessing : true
property theMaxMessagesToProcess : 5
-- The voice to use when speaking. This should be one of the voices in System Preferences > Dictation & Speech > Text to Speech
property theVoice : "Alex"
-- Tihs setting controls whether the script raises the volume to speak, if needed.
property raiseVolumeIfNeeded : true
@benwaldie
benwaldie / 2013-03-31-TUAW_Waldie.applescript
Created April 1, 2013 02:36
TUAW > AppleScripting Microsoft Outlook > Announce New Emails By Voice
-- Options to process a maximum number of messages
property limitMessageProcessing : true
property theMaxMessagesToProcess : 5
-- The voice to use when speaking. This should be one of the voices in System Preferences > Dictation & Speech > Text to Speech
property theVoice : "Alex"
-- Tihs setting controls whether the script raises the volume to speak, if needed.
property raiseVolumeIfNeeded : true
@benwaldie
benwaldie / 2013-04-05-TUAW_Waldie.applescript
Created April 5, 2013 16:45
AppleScripting Email > Developing a Quoted Reply Service
-- This handler is triggered by Automator. The input and parameters variables are populated by Automator. Input contains the selected text passed to the workflow for processing.
on run {input, parameters}
-- Make sure the input is a string
set theText to input as string
-- Determine the maximum length for each line. Note that some lines may be longer, if needed to prevent words from breaking
set theMaxLineLength to 42
-- Determine the prefix for each line