Safari URL to Evernote Quickie

Easy script to clip the current Safari URL to a specific Evernote Notebook

-- This is my attempt to simulate Yojimbo's tag collections with Applescript and Evernote.
-- This is as simple as I could make it.
-- v1.2 ...cb

-- Proper use of this script is to duplicate it for each project, and launch it using
-- something like FastScripts from Red Sweater http://www.red-sweater.com/fastscripts/

-- In other words, this script will just slam a note into the specified notebook with
-- the specified tags.  Tags and the notebook will be created without confirmation, if
-- they don't already exist.

-- The contents of the note will be the contents of the Web page.  This script does
-- NOT respect the 'Reader' feature of Safari.  I guess that will be v2.0

-- GTD Note: The Evernote mail syntax uses the @ to prefix notebook names,
-- so I renamed my @Inbox to _Inbox...  just so you know.

-- This is supposed to be quick.  If we load Evernote on the fly, it takes forever,
-- therefore I'm reporting failure, and bailing.  You can start Evernote manually.

if application "Evernote" is running then -- exit quickly if run accidentally, and Evernote is not running
  if application "Safari" is running then -- exit quickly if run accidentally, and Safari is not running
    set notebookName to "_Inbox" -- what notebook are we using
    set tagList to {"URL", "Web Page"} -- what tags do we want
    
    -- Get useful information from current tab of current Safari window
    tell application "Safari"
      set safariWindow to window 1 -- need an object reference to Safari
      set tabURL to (URL of current tab of safariWindow) -- Safari shows Web pages in tabs, so get the URL of the tab
      set tabName to (name of current tab of safariWindow) -- Get the name of the tab
    end tell
    
    -- Create a new note in Evernote with the information collected above.
    tell application "Evernote"
      set newNote to create note title tabName from url tabURL notebook notebookName tags tagList
      beep (beep (beep)) -- unobtrusive notification of success, same as Evernote itself
    end tell
  else
    display dialog "Safari is not running!" -- report failure
  end if
else
  display dialog "Evernote is not running!" -- report failure
end if