├── .gitignore
├── README.md
├── breakaway
├── breakaway-spotify.applescript
├── breakaway-spotify.scpt
├── breakaway-vlc.applescript
└── breakaway-vlc.scpt
├── list-safari-tabs
├── README.md
└── safari-tabs-to-clipboard.applescript
├── marked-preview
└── marked-preview.applescript
├── print-attachment
├── README.md
├── print-attachment.applescript
├── print-ios-folder.workflow
│ └── Contents
│ │ ├── Info.plist
│ │ ├── QuickLook
│ │ └── Thumbnail.png
│ │ └── document.wflow
└── screenshot.png
└── send-everything-to-instapaper
├── README.md
└── send-everything-to-instapaper.applescript
/.gitignore:
--------------------------------------------------------------------------------
1 | *.un~
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | I will track all of my various tidbits in this repo… Mostly AppleScripts and
2 | Keyboard Maestro Macros.
3 |
4 | But also some Ruby, Python and PHP scripts. Whatever I think might be
5 | interesting for fellow Mac users.
6 |
7 | So far:
8 |
9 | ## Marked preview
10 |
11 | A very simple AppleScript to open the current document in Marked for quick
12 | preview
13 |
14 | ## Print attachment
15 |
16 | An AppleScript and an Automator workflow to automatically print attachments
17 | that come in at a certain email address
18 |
--------------------------------------------------------------------------------
/breakaway/breakaway-spotify.applescript:
--------------------------------------------------------------------------------
1 | tell application "System Events"
2 | set app_list to every application process whose name is "Spotify"
3 | if the (count of app_list) > 0 then
4 | tell application "Spotify" to pause
5 | end if
6 | end tell
--------------------------------------------------------------------------------
/breakaway/breakaway-spotify.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/martijnengler/tools/007af12d48b942692cd0d3d8b1f6e0c568a3788a/breakaway/breakaway-spotify.scpt
--------------------------------------------------------------------------------
/breakaway/breakaway-vlc.applescript:
--------------------------------------------------------------------------------
1 | tell application "System Events"
2 | set app_list to every application process whose name is "VLC"
3 | if the (count of app_list) > 0 then
4 | tell application "VLC" to play
5 | end if
6 | end tell
--------------------------------------------------------------------------------
/breakaway/breakaway-vlc.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/martijnengler/tools/007af12d48b942692cd0d3d8b1f6e0c568a3788a/breakaway/breakaway-vlc.scpt
--------------------------------------------------------------------------------
/list-safari-tabs/README.md:
--------------------------------------------------------------------------------
1 | Get a nicely formatted list (Markdown) containing all the tabs from the front window.
2 |
3 | It's formatted in a list (everything is prefixed with an asterisk ("*")),
4 | has the title between quotes, a dash and the URL of the tab.
--------------------------------------------------------------------------------
/list-safari-tabs/safari-tabs-to-clipboard.applescript:
--------------------------------------------------------------------------------
1 | (*
2 | Safari tabs to clipboard
3 |
4 | Copies the URLs and titles of everything in your (front) Safari window to the clipboard.
5 |
6 | By Martijn Engler (http://applecoach.nl)
7 | October 9, 2012
8 | *)
9 | tell application "Safari"
10 | set theWindow to front window
11 | set theTabs to theWindow's tabs --of every window
12 | set result to ""
13 | repeat with eachTab in theTabs
14 | set result to result & "* \"" & name of eachTab & "\": \"" & URL of eachTab & "
15 | "
16 | end repeat
17 | set the clipboard to the text of result
18 | end tell
--------------------------------------------------------------------------------
/marked-preview/marked-preview.applescript:
--------------------------------------------------------------------------------
1 | (*
2 | Marked preview
3 |
4 | A script to open the current document (in your editor) in the awesome Marked app
5 |
6 | By Martijn Engler (http://applecoach.nl)
7 | September 19, 2012
8 |
9 | Works great with Keyboard Maestro:
10 | http://keyboardmaestro.com/main/
11 | *)
12 |
13 | -- got this method from http://vanderbrew.com/blog/2010/02/15/get-current-application-with-applescript/
14 | on GetCurrentApp()
15 | tell application "System Events"
16 | set _app to item 1 of (every process whose frontmost is true)
17 | return name of _app
18 | end tell
19 | end GetCurrentApp
20 |
21 | tell application GetCurrentApp()
22 | set theFilename to get the file of the document of the first window
23 | end tell
24 |
25 | tell application "Marked"
26 | open theFilename
27 | activate
28 | end tell
--------------------------------------------------------------------------------
/print-attachment/README.md:
--------------------------------------------------------------------------------
1 | ## Purpose
2 |
3 | Using the provided AppleScript with a rule and the Automator-workflow on
4 | a folder, you can use this script to automatically print attachments coming in on a certain email address (or some other rule you provide)
5 |
6 | ## Credits
7 |
8 | Based on the great work of the awesome Dave Caolo of 52tiger.net
9 |
10 | Original can be found here: http://52tiger.net/print-from-ios-dropbox-ifttt-automator
11 |
12 | Differences between our workflows:
13 |
14 | * Mine assumes you don't want to use ifttt, and have a Mac that's always run
15 | * My automator file automatically deletes the file after it's printed
16 |
17 | ## Installation
18 |
19 | Installation is simple:
20 |
21 | 1. Create a folder you want to use as temp storage for the to-print documents
22 | 2. Install the workflow and set it to this folder
23 | 3. Place the applescript in the folder ~/Library/Application
24 | Scripts/com.apple.mail (just create it, if it doesn't exist yet)
25 | 4. Create a new rule in Mail, something like this:
26 | 
27 | 5. Send an email with an attachment to the specified email address
28 | 6. Wait a few seconds… It's printing!
29 |
--------------------------------------------------------------------------------
/print-attachment/print-attachment.applescript:
--------------------------------------------------------------------------------
1 | -- borrowed some code from this script:
2 | -- http://www.macosxtips.co.uk/index_files/automatically-save-mail-attachments-using-applescript.php
3 |
4 | -- for some reason I can't get this to work
5 | -- so the actual path is a few lines down in the code, as home:dropbox:ios-print
6 | -- just change it there and everything should work fine
7 | global attachmentsFolder
8 | set attachmentsFolder to ((path to home folder as text) & "Dropbox:ios-print") as text
9 |
10 | using terms from application "Mail"
11 | on process_message(theMessage)
12 | set attachmentsFolder to "home:Dropbox:ios-print"
13 | set {year:y, month:m, day:d, hours:h, minutes:min} to theMessage's date sent
14 | set timeStamp to ("" & y & "-" & my pad(m as integer) & "-" & my pad(d) & "-" & my pad(h) & "-" & my pad(min))
15 | repeat with theAttachment in theMessage's mail attachments
16 | set originalName to name of theAttachment
17 | set savePath to attachmentsFolder & ":" & timeStamp & " " & originalName
18 |
19 | -- slight modification, so it works on Mountain Lion
20 | save theAttachment in file savePath
21 | end repeat
22 | end process_message
23 |
24 | on perform mail action with messages theMessages
25 | try
26 | set theMessageCount to count of theMessages
27 | -- set theMessageCount to 1
28 | repeat with theMessageIndex from 1 to theMessageCount
29 | my process_message(item theMessageIndex of theMessages)
30 | end repeat
31 | on error m number n
32 | display dialog the "Exception in Mail action: (" & n & ") " & m
33 | end try
34 | end perform mail action with messages
35 |
36 | -- Adds leading zeros to date components
37 | on pad(n)
38 | return rich text -2 thru -1 of ("00" & n)
39 | end pad
40 | end using terms from
--------------------------------------------------------------------------------
/print-attachment/print-ios-folder.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMFolderAction
6 | AMAddingFolderItems
7 |
8 |
9 |
--------------------------------------------------------------------------------
/print-attachment/print-ios-folder.workflow/Contents/QuickLook/Thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/martijnengler/tools/007af12d48b942692cd0d3d8b1f6e0c568a3788a/print-attachment/print-ios-folder.workflow/Contents/QuickLook/Thumbnail.png
--------------------------------------------------------------------------------
/print-attachment/print-ios-folder.workflow/Contents/document.wflow:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMApplicationBuild
6 | 346
7 | AMApplicationVersion
8 | 2.3
9 | AMDocumentVersion
10 | 2
11 | actions
12 |
13 |
14 | action
15 |
16 | AMAccepts
17 |
18 | Container
19 | List
20 | Optional
21 |
22 | Types
23 |
24 | com.apple.applescript.alias-object
25 |
26 |
27 | AMActionVersion
28 | 1.0.2
29 | AMApplication
30 |
31 | Finder
32 |
33 | AMParameterProperties
34 |
35 | printerName
36 |
37 |
38 | AMProvides
39 |
40 | Container
41 | List
42 | Types
43 |
44 | com.apple.applescript.alias-object
45 |
46 |
47 | ActionBundlePath
48 | /System/Library/Automator/Print Finder Items.action
49 | ActionName
50 | Print Finder Items
51 | ActionParameters
52 |
53 | printerName
54 | Default Printer
55 |
56 | BundleIdentifier
57 | com.apple.Automator.PrintFinderItems
58 | CFBundleVersion
59 | 1.0.2
60 | CanShowSelectedItemsWhenRun
61 |
62 | CanShowWhenRun
63 |
64 | Category
65 |
66 | AMCategoryUtilities
67 |
68 | Class Name
69 | AMPrintFinderItemsAction
70 | InputUUID
71 | DCFAE45D-5478-4EC7-9A39-F6058FDF6242
72 | Keywords
73 |
74 | File
75 | Print
76 |
77 | OutputUUID
78 | 3D1BB11B-3D40-4E03-98E3-9AADA0FFD0EA
79 | UUID
80 | 5D5DA5B3-493D-4F21-86DB-2B7FCC9C3096
81 | UnlocalizedApplications
82 |
83 | Finder
84 |
85 | arguments
86 |
87 | 0
88 |
89 | default value
90 | Default Printer
91 | name
92 | printerName
93 | required
94 | 0
95 | type
96 | 0
97 | uuid
98 | 0
99 |
100 |
101 | nibPath
102 | /System/Library/Automator/Print Finder Items.action/Contents/Resources/English.lproj/main.nib
103 |
104 |
105 |
106 | action
107 |
108 | AMAccepts
109 |
110 | Container
111 | List
112 | Optional
113 |
114 | Types
115 |
116 | com.apple.cocoa.path
117 |
118 |
119 | AMActionVersion
120 | 1.1.2
121 | AMApplication
122 |
123 | Finder
124 |
125 | AMParameterProperties
126 |
127 | ActionBundlePath
128 | /System/Library/Automator/Move Finder Items to Trash.action
129 | ActionName
130 | Move Finder Items to Trash
131 | ActionParameters
132 |
133 | BundleIdentifier
134 | com.apple.Automator.MoveToTrash
135 | CFBundleVersion
136 | 1.1.2
137 | CanShowSelectedItemsWhenRun
138 |
139 | CanShowWhenRun
140 |
141 | Category
142 |
143 | AMCategoryUtilities
144 | AMCategoryFilesAndFolders
145 |
146 | Class Name
147 | MoveToTrashAction
148 | InputUUID
149 | 7060EE5B-D06B-46EA-A79D-D5EFD98F033A
150 | Keywords
151 |
152 | File
153 | Folder
154 | Move
155 | Trash
156 | Delete
157 |
158 | UUID
159 | 25E48B09-9C53-43FB-AA4B-C0CD7F69D661
160 | UnlocalizedApplications
161 |
162 | Finder
163 |
164 | arguments
165 |
166 | conversionLabel
167 | 0
168 |
169 |
170 |
171 | connectors
172 |
173 | 0BEC437E-5B3B-4F1E-A5E5-BB61DD6ECEC5
174 |
175 | from
176 | 5D5DA5B3-493D-4F21-86DB-2B7FCC9C3096 - 5D5DA5B3-493D-4F21-86DB-2B7FCC9C3096
177 | to
178 | 25E48B09-9C53-43FB-AA4B-C0CD7F69D661 - 25E48B09-9C53-43FB-AA4B-C0CD7F69D661
179 |
180 |
181 | workflowMetaData
182 |
183 | folderActionFolderPath
184 | ~/Dropbox/ios-print
185 | workflowTypeIdentifier
186 | com.apple.Automator.folderAction
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/print-attachment/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/martijnengler/tools/007af12d48b942692cd0d3d8b1f6e0c568a3788a/print-attachment/screenshot.png
--------------------------------------------------------------------------------
/send-everything-to-instapaper/README.md:
--------------------------------------------------------------------------------
1 | A faily simple script:
2 |
3 | 1. It asks you for your Instapaper credentials; don't worry, I won't send them
4 | to some server of mine. Check the source if you like. (You can even hardcode
5 | your credentials if you like that).
6 | 2. It takes a look at your front window in Safari
7 | 3. It loops through all your tabs and sends them to Instapaper
8 | 4. After sending a tab to Instapaper it's automatically closed
9 | 5. At the end of it the window is closed and your Instapaper is full :)
10 |
--------------------------------------------------------------------------------
/send-everything-to-instapaper/send-everything-to-instapaper.applescript:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/martijnengler/tools/007af12d48b942692cd0d3d8b1f6e0c568a3788a/send-everything-to-instapaper/send-everything-to-instapaper.applescript
--------------------------------------------------------------------------------