(* Bookmark in Yojimbo 1.0 by Jim DeVona http://anoved.net/bookmark_in_yojimbo.html 18 November 2006 Bookmark the current Safari page in Yojimbo. A small dialog allows you to change the name of the bookmark, which defaults to the page title. In addition to simply filing the bookmark you can also "Bookmark & Edit," which displays the bookmark in Yojimbo after creating it (handy for editing tags, comments, or other item properties). Requirements: Developed with Yojimbo 1.3 and Safari 2.0.4 on Mac OS X 10.4.8 Your mileage may vary with other configurations (Yojimbo 1.1 is probably the minimum) Suggested installation location: ~/Library/Scripts/Applications/Safari/ You can invoke this script with the standard Mac OS X Script Menu or you could use any one of many excellent third party utilities to invoke it with a keyboard shortcut - even to intercept your browser's regular new-bookmark shortcut. It may even be possible to bind it to browser buttons or menu items with UI scripting. (I have tested it with both FastScripts and Keyboard Maestro.) Tools Cited: http://www.barebones.com/products/yojimbo/ http://www.apple.com/applescript/scriptmenu/ http://www.red-sweater.com/fastscripts/ http://www.keyboardmaestro.com/main/ Wishes & Issues: - support for other browsers besides Safari - check for duplicate existing bookmarks *) tell application "Safari" -- what is the url and title of the page to bookmark? try set the_url to the URL of document 1 set url_title to the name of document 1 on error -- no document available to bookmark -- beep return end try -- quick edit of bookmark name and offer more advanced editing set dlog to display dialog "Bookmark \"" & the_url & "\" as:" default answer url_title with title "Bookmark in Yojimbo" buttons {"Cancel", "Bookmark & Edit", "Bookmark"} default button 3 cancel button 1 set url_title to the text returned of dlog set choice to the button returned of dlog if the choice = "" or the choice = "Cancel" then return else if the choice = "Bookmark" then set show to false else set show to true end if end tell tell application "Yojimbo" -- check for other bookmark items with identical location properties -- prompt the user to replace, cancel, or instead edit -- create the bookmark set db_id to make new bookmark item with properties {name:url_title, location:the_url} -- reveal the bookmark for editing if show then activate -- hack to "show db_id" by opening it as a URL open location "x-yojimbo-item://" & (id of db_id) end if end tell