Skip to content

Instantly share code, notes, and snippets.

@vanmik
Created September 15, 2010 02:16
Show Gist options
  • Save vanmik/580136 to your computer and use it in GitHub Desktop.
Save vanmik/580136 to your computer and use it in GitHub Desktop.
applescript allows to insert custom text in any os x app
-- 'selection' work in Pages.app only
tell application "Pages"
set selText to selection
end tell
tell me
activate
display dialog "Type a tag" default answer ""
set the_text to the text returned of result
end tell
set the clipboard to "<" & the_text & ">" & selText & "</" & the_text & ">"
tell application "System Events"
tell application "Pages" to activate
tell process "Pages" to key code 9 using command down
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment