Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arthurlockman/dab6ad25b807dd4f08ca to your computer and use it in GitHub Desktop.
Save arthurlockman/dab6ad25b807dd4f08ca to your computer and use it in GitHub Desktop.
#!/usr/local/bin/zsh
osascript -e 'tell application "Notes" to activate
delay 2'
for f in $@*.html
do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
if [ "$filename" != "index" ]
then
echo "$filename" | tr _ - | pbcopy
osascript -e 'tell application "Notes"
activate
tell application "System Events" to tell process "Notes"
click menu item "New Note" of menu 1 of menu bar item "File" of menu bar 1
keystroke "v" using command down
keystroke "a" using command down
keystroke "t" using {command down, shift down}
key code 125
end tell
end tell'
textutil -format html -convert rtf -stdout "$f" | pbcopy
osascript -e 'tell application "Notes"
activate
tell application "System Events" to tell process "Notes"
keystroke return
keystroke "v" using command down
end tell
end tell'
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment