Skip to content

Instantly share code, notes, and snippets.

@collindonnell
Created February 29, 2012 05:56
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save collindonnell/1938323 to your computer and use it in GitHub Desktop.
Save collindonnell/1938323 to your computer and use it in GitHub Desktop.
Preview BBEdit Document in Marked
-- Preview the currently active BBEdit document using Marked.
tell application "BBEdit"
activate
-- Ask BBEdit for it's active document.
set the_document to active document of text window 1
-- If the file doesn't alreay exist, ask the user to save it.
if not the_document's on disk then
save the_document
end if
-- If the file is now on disk, open it using Marked.
if the_document's on disk then
tell application "Marked"
set the_file to the_document's file
open the_file
-- Bring Marked forward so it becomes visible.
activate
end tell
-- Bring BBEdit back to being the frontmost application.
activate
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment