WebNoteFoxy

From the archive — written 20 years ago. About old posts.

Update: WebnoteHappy 1.2 removes the need for any fiddling with scripts or the like … Firefox support just works now, just as it does with Safari. Yay!

I dig WebNoteHappy but I don’t dig the way the shift-&8984;-d keystroke for making new notes doesn’t work in Firefox. I mean … there’s always the nifty bookmarklet, but I don’t like having to release the keyboard, grab the mouse, and find the bookmarklet. It’s friction in a process I’d prefer be frictionless when I’m lining up a bunch of stuff from a long list of tabs for later reading.

Fortunately, I also dig Spark, so it was pretty easy to write a quick AppleScript that grabs the URL and name of the frontmost Firefox window, prompts for some tags, then makes a new webnote, then use Spark to tie that Applescript to shift-&8984;-d, which the WebNoteHappy people thoughtfully fixed so the keystroke’s unreserved for apps that don’t talk to it natively.

Prettified script after the jump.

–Open this script in a new Script Editor window.


tell application &34;System Events&34;

&160;&160;&160;&160;if ((application processes whose (name is equal to &34;firefox-bin&34;)) count) is greater than 0 then

&160;&160;&160;&160;&160;&160;&160;&160;if (count of windows of application &34;Firefox&34;) is greater than 0 then

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;tell application &34;Firefox&34;

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set theUrl to &171;class curl&187; of window 1

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set theTitle to the name of window 1

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set theTags to the text returned of (display dialog &34;Tags:&34; default answer &34;&34;)

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;end tell

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;

&160;&160;&160;&160;&160;&160;&160;&160;else

&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;return &34;Firefox is not running&34;

&160;&160;&160;&160;&160;&160;&160;&160;end if

&160;&160;&160;&160;else

&160;&160;&160;&160;&160;&160;&160;&160;return &34;Firefox is not running&34;

&160;&160;&160;&160;end if

end tell




tell application &34;WebnoteHappy&34;

&160;&160;&160;&160;activate

&160;&160;&160;&160;make new webnote with properties {url:theUrl, title:theTitle, tags:theTags}

&160;&160;&160;&160;

end tell

Drop a line about this.