Skip to content

Instantly share code, notes, and snippets.

View benwaldie's full-sized avatar

Ben Waldie benwaldie

View GitHub Profile
@benwaldie
benwaldie / CreateTaggedEvernote
Created June 15, 2015 15:10
Create and tag note in Evernote
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 / 2012-11-16-TUAW_Waldie.applescript
Created November 19, 2012 20:35
TUAW - Create Evernote Template Notebook
-- Get the path to the Evernote templates folder
set theTemplatesFolder to (path to documents folder as string) & "Evernote Templates:" as alias
-- Retrieve a list of template file names without their .enex extensions
set theTemplateNames to list folder theTemplatesFolder without invisibles
repeat with a from 1 to length of theTemplateNames
set aTemplate to item a of theTemplateNames
if aTemplate contains ".enex" then set aTemplate to text 1 thru -6 of aTemplate
set item a of theTemplateNames to aTemplate
end repeat
@benwaldie
benwaldie / 2012-11-25-TUAW_Waldie-2.applescript
Created November 26, 2012 04:14
TUAW - Cascade Finder Windows
-- Ask the user to enter some preliminary values for positioning and sizing the windows
set theTopOffset to askForInput("How many pixels would you like between the menu bar and the first window?", 10)
set theLeftOffset to askForInput("How many pixels would you like between the left of the screen and the first window?", 10)
set theWindowHeight to askForInput("How many pixels high would you like each window?", 300)
set theWindowWidth to askForInput("How many pixels wide would you like each window?", 350)
set theWindowOffset to askForInput("How many pixels would you like the windows offset from one another?", 25)
set staggerWindows to (button returned of (display dialog "Would you like the windows to cascade to the right?" buttons {"No", "Yes"} default button "Yes")) = "Yes"
-- Compensate for the menu bar
set theTopOffset to theTopOffset + 45
@benwaldie
benwaldie / 2012-11-25-TUAW_Waldie-1.applescript
Created November 26, 2012 04:10
TUAW - Set Up Cascade Windows Test
-- Prepare a name for the test folder
set theRootFolderName to "Cascade Windows Test"
-- Close any opened windows
tell application "Finder"
close every window
-- Locate the test folder, creating it if it doesn't exist
if folder theRootFolderName of desktop exists then
set theRootFolder to folder theRootFolderName of desktop
@benwaldie
benwaldie / 2012-12-23-TUAW_Waldie.applescript
Last active December 10, 2015 02:28
TUAW - AppleScript Desktop Icon Race
-- Set up some initial starting positions and offsets
property theRaceStartingLineTopPosition : 50
property theRaceStartingLineLeftPosition : 100
property theRaceStartingLineBottomOffset : 200
property theRaceFinishLineRightOffset : 200
-- Determine the screen size
tell application "Finder"
set theDesktopBounds to bounds of window of desktop
set theDesktopWidth to item 3 of theDesktopBounds
@benwaldie
benwaldie / 2013-01-06-TUAW_Waldie.applescript
Created January 7, 2013 01:59
TUAW > OmniFocus > Swap Selected Task Names and Notes
tell application "OmniFocus"
-- Target the content of the front window
tell content of front window
-- Retrieve every selected task
set theTasks to value of every selected tree
-- Notify the user if no tasks are selected
if theTasks = {} then
@benwaldie
benwaldie / 2013-01-13-TUAW_Waldie.applescript
Created January 14, 2013 02:37
TUAW > Send OmniFocus Due Tasks to iTunes
-- Set this property to the perspective you want to process
property thePerspectiveName : "Due"
-- Set up a variable for the task list text
set theTaskList to ""
-- Target OmniFocus
tell application "OmniFocus"
activate
@benwaldie
benwaldie / 2013-01-20-TUAW_Waldie1.applescript
Last active December 11, 2015 09:58
TUAW > TextExpander Date Snippet > Next Sunday
set theDate to (current date) + 1 * days
repeat until weekday of theDate = Sunday
set theDate to theDate + 1 * days
end repeat
set theDate to year of theDate & "-" & (text -2 thru -1 of ("0" & (month of theDate as integer))) & "-" & (text -2 thru -1 of ("0" & (day of theDate as integer))) as string
@benwaldie
benwaldie / 2013-01-20-TUAW_Waldie2.applescript
Created January 21, 2013 03:22
TUAW > TextExpander Date Snippets > Current Week
set theDate to (current date)
set theStartDate to theDate
repeat until weekday of theStartDate = Sunday
set theStartDate to theStartDate - 1 * days
end repeat
set theEndDate to theDate
repeat until weekday of theEndDate = Saturday
set theEndDate to theEndDate + 1 * days
end repeat
set theDate to (short date string of theStartDate) & " - " & (short date string of theEndDate)
@benwaldie
benwaldie / 2013-01-27-TUAW_Waldie.applescript
Last active December 11, 2015 19:58
TUAW > Evernote > Scale Embedded Images
-- Receive images as input
on open theImages
-- Ask the user to specify a scaled image size
set theChoice to choose from list {"Low", "Medium", "High", "Custom"} default items {"Medium"} with title "Evernote > Scale Images Script" with prompt "Scale to what size?"
if theChoice = false then return
set theChoice to item 1 of theChoice
-- Set the maximum number of pixels accordingly, based on the specified scaled image size
if theChoice = "Low" then