Skip to content

Instantly share code, notes, and snippets.

Ben Waldie benwaldie

Block or report user

Report or block benwaldie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benwaldie
benwaldie / saveSelectedMailAttachments.applescript
Created Oct 27, 2016
Save Selected Mail Message Attachments
View saveSelectedMailAttachments.applescript
set theSavePath to path to desktop folder as string
tell application "Mail"
selection
set theMessage to item 1 of result
set theAttachments to every mail attachment of theMessage
repeat with anAttachment in theAttachments
set theName to name of anAttachment
save anAttachment in file (theSavePath & theName)
end repeat
end tell
@benwaldie
benwaldie / CreateTaggedEvernote
Created Jun 15, 2015
Create and tag note in Evernote
View CreateTaggedEvernote
tell application "Evernote"
activate
set theNote to create note with text "ABC"
set tags of theNote to {tag "Tag 1", tag "Tag 2"}
end tell
@benwaldie
benwaldie / 2014-04-03 Send Keynote Presenter Notes to Evernote.applescript
Created Apr 3, 2014
This script sends presenter notes from a Keynote 6.2 presentation to Evernote.
View 2014-04-03 Send Keynote Presenter Notes to Evernote.applescript
--==============================
-- Send Keynote Presenter Notes to Evernote
-- Version 1.0.1
-- Written By: Ben Waldie <ben@automatedworkflows.com>
-- http://www.automatedworkflows.com
-- Version 1.0.0 - Initial release
-- Version 1.0.1 - Updated for Keynote 6.2 compatibility
--==============================
@benwaldie
benwaldie / Example.applescript
Created Dec 2, 2013
Get the address from a selected contact and add it to a Pages '09 document, right aligned, with the date.
View Example.applescript
tell application "Contacts"
set theSelection to selection
set thePerson to item 1 of theSelection
set theAddress to address 1 of thePerson
set theAddressText to formatted address of theAddress
end tell
set theDate to short date string of (current date)
tell application "Pages"
@benwaldie
benwaldie / textedit_find_replace.applescript
Last active Dec 5, 2017
Find and replace text in an opened TextEdit document using AppleScript.
View textedit_find_replace.applescript
-- Find and replace a single word in an opened TextEdit document
tell application "TextEdit"
make new document
-- Add some text to the document
set text of front document to "The quick fox jumped over the lazy dog."
-- Find and replace
set every word of front document where it = "fox" to "elephant"
end tell
@benwaldie
benwaldie / NC_Disable_DoNotDisturb.applescript
Created Jun 4, 2013
Notification Center > Disable Do Not Disturb Tested with 10.8.3
View NC_Disable_DoNotDisturb.applescript
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 / NC_Enable_DoNotDisturb.applescript
Created Jun 4, 2013
Notification Center > Enable Do Not Disturb Tested with 10.8.3
View NC_Enable_DoNotDisturb.applescript
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"
View WebScraper.applescript
-- Get the text from Safari
tell application "Safari"
set thePageText to text of document 1
end tell
-- Split the text into paragraphs
set thePars to paragraphs of thePageText
-- Find all paragraphs matching the desired criteria
set theText to ""
@benwaldie
benwaldie / 2013-04-28-TUAW_Waldie.applescript
Created Apr 29, 2013
TUAW > Adding Copy to Clipboard Phone Number Rollover in Contacts App via AppleScript
View 2013-04-28-TUAW_Waldie.applescript
-- "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-04-21-TUAW_Waldie.applescript
Created Apr 22, 2013
TUAW > Extract App Resource Icons with AppleScript
View 2013-04-21-TUAW_Waldie.applescript
-- Ask the user to select an app
set theApp to choose file of type "app" default location (path to applications folder)
-- Get the app name
tell application "System Events"
set theAppName to name of theApp
if theAppName ends with ".app" then set theAppName to text 1 thru -5 of theAppName
-- Determine whether the app is a package, and notify the user if it's not
set isPackage to (package folder of theApp)
You can’t perform that action at this time.