Open with BBEdit

May 1st, 2006

This is a tiny Automator Workflow that opens the current Safari document with BBEdit.

Previously I wrote an AppleScript that did the very same job, however the new document was marked as “new”, thus when one tried to close it, BBEdit would complain and ask if we wanted to save

tell application "Safari"
	set cur to document 1
	set mySource to source of cur
	set myName to name of cur
end tell
tell application "BBEdit"
	set x to make new text document with properties ¬
		{contents:mySource, name:myName}
	activate
end tell

However if we use the automator action “New BBEdit Document”, it offers the possibility to “Set unmodified” (that is to say the new document won’t ask if it has to be saved before closing).

I created a two step Automator workflow. The first step is a slightly modified version of the first part of the script. It is a “Run AppleScript action” containing

    on run {input, parameters}
    	tell application "Safari"
    		set cur to document 1
    		set mySource to source of cur
    		set myName to name of cur
    	end tell
    	return mySource
    end run

The second step is the “New BBEdit Document” action.

You can download the workflow here. I sugest to put it in the script menu.

Mac, Mac Programming | Comments | Trackback

Leave a Reply

  1.  
  2.  
  3.  
  4. XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
You can keep track of new comments to this post with the comments feed.

Recent Posts

Blogroll

Siti amici

Misc

Recent Comments

Categories

Enrico Franchi graduated in Maths and Computer Science and is now studying for a Computet Science MSc (though because of italian bureaucracy that very course is to be cancelled).

RiK0's Tech Temple is using WP-Gravatar