Yojimbo レジストしちゃいました

Yojimbo 結局買っちゃいました。Journler があるからとか言いつつ、やはりこの便利さには抗い切れなかった(過去記事:Yojimbo いいじゃないか 参照)。

おまけに、先日 pukka というソフトを使って del.icio.us にウェブページのブックマーク、そして Yojimbo にはアーカイブを保存してくれる Applescript があると記事にしたが、それを書き換えて Yojimbo にもブックマークする Applescript が判ったのだ(過去記事:Yojimboとdel.cio.usどちらもマークしたい 参照)。

pukka や Yojimbo のブックマークレットを Safari のブックマークバーに登録しているだけでもかなり便利だったのに、それを一度にやっちゃってくれるもんだから、これはもう手放せません。

この Applescript は Yojimbo-Talk List というフォーラムを検索していて見つけたのだが、基本的には Dylan Damian さんが書かれた Yojimbo にアーカイブを保存する Applescript を書き換えたものだ。そのフォーラムの中のやり取りから実際に書き換えて試してみたら、見事に希望通り pukka を経由して del.icio.us にも Yojimbo にもブックマークを保存してくれた。

こういう物にも著作権とかありそうなので、掲載するのを躊躇したんだけど、個人的に使う分なら良いですよね。と言う事で以下がその Applescript 。


-- SafariToPukkaAndYojimbo
-- Bookmark current Safari page to del.icio.us and
-- archive it with Yojimbo
-- by Dylan Damian (dylan.damian@gmail.com)
-- Version 0.3.2

tell application "Safari"
	set myURL to URL of document 1
	set myTitle to do JavaScript "document.title" in document 1
	set mySelection to do JavaScript "window.getSelection() + ''" in document 1
end tell

tell application "Pukka"
	set post url to myURL
	set post title to myTitle
	if (length of mySelection is not 0) then
		set post description to mySelection
	end if
	
	activate
	set frontmost to true
	tell window 1
		set visible to true
	end tell
	
	set skip next reset to true
end tell

tell application "System Events"
	key code 48
	key code 48
end tell

tell application "System Events"
	if exists process "Pukka" then
		repeat
			set windList to every window of application process "Pukka"
			set windowOpen to count of windList
			if windowOpen = 0 then exit repeat
			delay 1
		end repeat
	end if
end tell

tell application "Pukka"
	set myTags to post tags
	set skip next reset to false
end tell

tell application "Yojimbo"
	set newItem to make new bookmark item with properties {name:myTitle, location:myURL, comments:mySelection}
	add tags myTags to newItem
end tell

tell application "GrowlHelperApp"
	-- Make a list of all the notification types
	-- that this script will ever send:
	set the allNotificationsList to ¬
		{"Success Notification", "Failure Notification"}
	
	-- Make a list of the notifications
	-- that will be enabled by default.
	-- Those not enabled by default can be enabled later
	-- in the 'Applications' tab of the growl prefpane.
	set the enabledNotificationsList to ¬
		{"Success Notification"}
	
	-- Register our script with growl.
	-- You can optionally (as here) set a default icon
	-- for this script's notifications.
	register as application ¬
		"SafariToPukkaAndYojimbo" all notifications allNotificationsList ¬
		default notifications enabledNotificationsList ¬
		icon of application "Yojimbo"
	
	--    Send a Notification...
	notify with name ¬
		"Success Notification" title ¬
		"Import Success" description ¬
		"Successfully imported \"" & myURL & ¬
		"\" to Yojimbo" application name "SafariToPukkaAndYojimbo"
	
	notify with name ¬
		"Failure Notification" title ¬
		"Import Failure" description ¬
		"Alas — you won't see me until you enable me..."
	application name
	"SafariToPukkaAndYojimbo"
	
end tell

これをスクリプトエディタにコピーし、適当な名前でスクリプトとして保存。 /Users/Library/Scripts/Applications/Safari/ 以下に入れれば、メニューバーの【スクリプトメニュー】から呼び出せる。ぼくの場合は Quicksilver のトリガーに登録してショートカットで呼び出すようにした。

付則として、pukka の Description(説明)はウェブページ内のテキストを選択したものでないと Yojimbo の Comments 欄には反映されない。つまり pukka の Description 内にタイピングしたものは del.icio.us には反映されるが、Yojimbo の Comments 欄は空欄になってしまう。(過去記事:pukka で del.cio.us 参照)

トラックバック

このエントリーのトラックバックURL:
http://www.sumainobaiten.com/blog/mt-tb.cgi/455

コメントを投稿

アーカイブ

最近のコメント

最近のトラックバック

Powered by
Movable Type 3.34