Skip to content

Commit

Permalink
Migrate scripts from iCloud to Git.
Browse files Browse the repository at this point in the history
  • Loading branch information
temochka committed Feb 22, 2020
0 parents commit 52c1e5b
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
10 changes: 10 additions & 0 deletions Mail/Copy Mail message URL.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tell application "Mail"
set _sel to get selection
set _links to {}
repeat with _msg in _sel
set _messageURL to "message://%3c" & _msg's message id & "%3e"
set end of _links to _messageURL
end repeat
set AppleScript's text item delimiters to return
set the clipboard to (_links as string)
end tell
Binary file added Notes/Copy Note URL.scpt
Binary file not shown.
Binary file added Notes/Generate Vocabulary Update.scpt
Binary file not shown.
85 changes: 85 additions & 0 deletions Notes/Open Note URL.app/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>applet</string>
<key>CFBundleIconFile</key>
<string>applet</string>
<key>CFBundleIdentifier</key>
<string>com.temochka.AppleScript.AppleNotesUrl</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Open Note URL</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>aplt</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Apple Notes</string>
<key>CFBundleURLSchemes</key>
<array>
<string>shortcuts</string>
</array>
</dict>
</array>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
<string>10.6</string>
</dict>
<key>LSRequiresCarbon</key>
<true/>
<key>NSAppleEventsUsageDescription</key>
<string>This script needs to control other applications to run.</string>
<key>NSAppleMusicUsageDescription</key>
<string>This script needs access to your music to run.</string>
<key>NSCalendarsUsageDescription</key>
<string>This script needs access to your calendars to run.</string>
<key>NSCameraUsageDescription</key>
<string>This script needs access to your camera to run.</string>
<key>NSContactsUsageDescription</key>
<string>This script needs access to your contacts to run.</string>
<key>NSHomeKitUsageDescription</key>
<string>This script needs access to your HomeKit Home to run.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This script needs access to your microphone to run.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This script needs access to your photos to run.</string>
<key>NSRemindersUsageDescription</key>
<string>This script needs access to your reminders to run.</string>
<key>NSSiriUsageDescription</key>
<string>This script needs access to Siri to run.</string>
<key>NSSystemAdministrationUsageDescription</key>
<string>This script needs access to administer this system to run.</string>
<key>WindowState</key>
<dict>
<key>bundleDividerCollapsed</key>
<true/>
<key>bundlePositionOfDivider</key>
<real>0.0</real>
<key>dividerCollapsed</key>
<false/>
<key>eventLogLevel</key>
<integer>2</integer>
<key>name</key>
<string>ScriptWindowState</string>
<key>positionOfDivider</key>
<real>256</real>
<key>savedFrame</key>
<string>332 -13 700 672 0 0 1920 1057 </string>
<key>selectedTab</key>
<string>result</string>
</dict>
</dict>
</plist>
Binary file added Notes/Open Note URL.app/Contents/MacOS/applet
Binary file not shown.
1 change: 1 addition & 0 deletions Notes/Open Note URL.app/Contents/PkgInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APPLaplt
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
{\fonttbl}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
}
7 changes: 7 additions & 0 deletions Safari/Open Highlighted Link.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tell application "Safari"
tell window 1
tell current tab
do JavaScript "window.getSelection().anchorNode.parentElement.closest('a,button').click()"
end tell
end tell
end tell
40 changes: 40 additions & 0 deletions Safari/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# macOS automation scripts

A collection of my macOS automation scripts (AppleScript and JXA).

## Mail

### Copy Mail message URL

Copies local URLs to messages in Apple Mail for quick referencing. URLs look like below and work both on macOS and iOS:

```
message://%[email protected]%3e
```

## Notes

### Open Note URL / Copy Note URL

Apple Notes doesn’t provide URLs that work reliably across devices. I link to my notes using the following URLs format

```
shortcuts://run-shortcut?name=NoteURL&input=1582228319
```

This format works both on macOS (via these scripts) and iOS (via custom shortcuts) and relies on note creation date, which is
extremely reliable and unlikely to change.

### Generate Vocabulary Update

Whenever I see an unknown English word, I add it to a note in "🇬🇧English" folder. This script combine these separate notes into a single list that I can load into my space repetition software.

## Safari

## Open Highlighted Link

Safari doesn’t automatically focus elements highlighted via search by page (like Chrome or Firefox). However, it can be done with a bit of AppleScript. [Read more](https://temochka.com/blog/posts/2018/12/18/navigating-the-web-safari.html) on my blog.

## Safari tab to OmniFocus

I could never figure out how to quickly add a Safari web page to OmniFocus (so it puts the page title into task and URL as a note) so I wrote this shortcut. Works for me!
Binary file added Safari/Safari tab to OmniFocus.scpt
Binary file not shown.

0 comments on commit 52c1e5b

Please sign in to comment.