Scripts
From Fraser Speirs Wiki
Contents |
Growl Mail Rule Applescript
I wrote a little Applescript that can be used as an action in a Mail.app rule to display a Growl notification showing the From and Subject headers.
Download: GrowlRule.scpt.zip
Add Safari Window to Del.icio.us @review tag
Here's an Applescript that takes the front tab in Safari and automatically posts it to Del.icio.us, giving it the tag "@review" and notifying you of success or failure via Growl. I designed this for use with Quicksilver, but it works in other ways too, such as Tiger's systemwide Script menu.
Download: @review.scpt.zip
Synchronize with iSync, then Quit
This script is again designed to run from Quicksilver. The idea was to remvoe the barrier to regularly syncing my phone by making it a single-keystroke Quicksilver trigger. The script will launch iSync, perform a sync and then quit iSync.
Note: To have this work, you need to save the script as an Application and check the Stay Open checkbox.
on run
set didSync to false
tell application "iSync"
activate
end tell
end run
on idle
tell application "iSync"
if didSync is false then
synchronize
set didSync to true
end if
if didSync is true and syncing is false then
quit
quit me
end if
end tell
return 1
Add front Safari tab to Yojimbo
I'm in love with Yojimbo. This script will take the front tab in Safari, create a new Yojimbo web archive and flag it.
set newItemTitle to do JavaScript "document.title" in front document
set theURL to URL of front document
end tell
tell application "Yojimbo"
set newItem to make new web archive item with contents theURL
set flagged of newItem to true
end tell
tell application "GrowlHelperApp"
set the allNotificationsList to {"Success Notification"}
set the enabledNotificationsList to {"Success Notification"}
register as application ¬
"Safari to Yojimbo Script" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Safari"
notify with name ¬
"Success Notification" title ¬
"Import Success" description "Successfully imported \"" & newItemTitle & ¬
"\" to Yojimbo" application name "Safari to Yojimbo Script"
&mp== Add selected NetNewsWire headlines to Yojimbo ==
Like the Safari script above, this will take each of the selected headlines in NetNewsWire and create new, flagged web archives in Yojimbo.
This script is based on Jan Erik Mostrom's script, except that I set the flagged property for easy retrieval later and notify through Growl. Enhancements to support adding the selected NNW tab to Yojimbo by Robert Fleming. Further optimisations by Beirne Konarski (2006-06-18).
set the allNotificationsList to {"Success Notification", "Failure Notification"}
set the enabledNotificationsList to {"Success Notification", "Failure Notification"}
register as application ¬
"NetNewsWire to Yojimbo Script" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "NetNewsWire"
end tell
tell application "NetNewsWire"
try
if (index of selected tab is not 0) then
set tabnum to index of selected tab + 1
set taburls to URLs of tabs
set h_URL to (get item tabnum of taburls)
set tabtitles to titles of tabs
set newItemTitle to (get item tabnum of tabtitles)
tell application "Yojimbo"
set flagged of (make new web archive item with contents h_URL) to true
tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title ¬
"Import Success" description "Successfully imported \"" & newItemTitle & ¬
"\" to Yojimbo" application name "NetNewsWire to Yojimbo Script"
end tell
end tell
else if exists selectedHeadline then
set h_URL to URL of selectedHeadline
set newItemTitle to title of selectedHeadline
tell application "Yojimbo"
set flagged of (make new web archive item with contents h_URL) to true
tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title ¬
"Import Success" description "Successfully imported \"" & newItemTitle & ¬
"\" to Yojimbo" application name "NetNewsWire to Yojimbo Script"
end tell
end tell
else
error "No headline is selected."
end if
on error error_message number error_number
tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title ¬
"Import Success" description "Failed to import \"" & newItemTitle & ¬
"\" to Yojimbo. Error: " & error_message application name "NetNewsWire to Yojimbo Script"
end tell
end try
