Skip to content

Instantly share code, notes, and snippets.

@cmittendorf
Created January 10, 2017 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmittendorf/da52f1368d05d5878ef8cf81aea07713 to your computer and use it in GitHub Desktop.
Save cmittendorf/da52f1368d05d5878ef8cf81aea07713 to your computer and use it in GitHub Desktop.
Creates a new Pages document from the text of the frontmost Safari document.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set content to missing value
tell application "Safari"
try
set content to text of first document
end try
end tell
if content is not missing value then
tell application "Pages"
activate
set new_document to make new document at end of documents
set body text of new_document to content
end tell
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment