Skip to content

Instantly share code, notes, and snippets.

View benwaldie's full-sized avatar

Ben Waldie benwaldie

View GitHub Profile
@benwaldie
benwaldie / 2013-04-12-TUAW_Waldie.applescript
Created April 12, 2013 18:17
TUAW > OmniFocus > Prepare Task Completion Report
-- This property controls whether full project paths (including parent folders) are displayed
property includeFullProjectPaths : true
-- These properties control whether additional task content is displayed
property includeTaskContext : true
property includeTaskEstimatedTime : true
property includeTaskStartDate : true
property includeTaskModificationDate : true
property includeTaskCompletionDate : true
property includeTaskNotes : 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
@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-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-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-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-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-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-10-TUAW_Waldie.applescript
Created February 11, 2013 01:39
TUAW > Elapsed Time Calculator
-- Ask the user to enter a date. Note, if no time is specified, then the date will default to 12:00 AM.
set theDate to text returned of (display dialog "Please enter a starting date:" default answer "8/9/1997 12:00PM" with icon note with title "Elapsed Time Calculator")
-- Coerce the entered date to an AppleScript date
set theDate to date theDate
-- Get the current date
set theCurrentDate to current date
-- Determine the number of months, years, seconds, minutes, hours, days, and weeks
@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"