Tag Archive: “mac”

Yojimbo Export with Comment Tags

In response to this query, I wrote a script which allows Yojimbo items to be exported with their tags preserved as Spotlight comments. I don’t really use Spotlight, so I’m not sure if the comment format is ideal, but it works fine for a first draft.

Example Screencast

Now updated for compatibility with Mac OS X 10.5.

Download ExportwithCommentTags.scpt.zip 1.2 4k

Put the script in ~/Library/Scripts/Applications/Yojimbo, select some items, and choose “Export with Comment Tags” from your script menu.

Posted on Thursday, August 30th, 2007.

“Open As” Pseudo-Stationery Finder AppleScript

Update: Now located at https://github.com/anoved/Finder-Scripts/tree/master/Open%20As


Use this AppleScript to create and open an explicitly named copy of the selected file or folder. You will be prompted to specify the name and location of the new copy. Clicking “Save” will duplicate the item and open the new duplicate.

Open As screenshot

This script is the result of dissatisfaction with some applications’ lack of support for Stationery Pad files. Specifically, the default behavior appears to be for the Finder to create and open a generic duplicate with “copy [#]” appended to the original base filename. I find it more convenient to name the new instance directly, so that is the functionality this script provides. Stationery pads are not required as it works with regular files.

Rigorous testing has not been performed. Be advised that duplication is performed with cp, which ignored the resource fork in early versions of Mac OS X. Therefore, Mac OS X 10.4 is strongly recommended for compatibility with all files.

Download FinderOpenAs.scpt.zip 3.4K

I suggest saving the script in ~/Library/Scripts/Applications/Finder and assigning it the keyboard shortcut Shift-Command-O via FastScripts.

Posted on Friday, August 17th, 2007.

Archive Yojimbo Bookmarks

Yojimbo can catalog bookmarks as well as web archives, which are basically local copies of web sites. This script creates web archives from existing bookmarks you select.

tell application "Yojimbo"
-- get the selected items, if any
 set _items to selection
 if _items is missing value then return

-- archive all the selected bookmark items
 repeat with _item in _items
  if class of _item is bookmark item then

-- bookmark properties the archive should inherit
   set _name to name of _item
   set _url to location of _item
   set _tags to tags of _item

-- archive the bookmarked page
   try
    set _archive to make new web archive item with contents _url with properties {name:_name}
    add tags _tags to _archive
   end try

end if
 end repeat
end tell

Download ArchiveYojimboBookmarks.scpt.zip 1.1 3k

Install the script in ~/Library/Scripts/Applications/Yojimbo. The script does not check whether there is already a web archive for the bookmarked location, but it could be done.

Posted on Sunday, July 15th, 2007.

Scaled LCD Resolution

My laptop’s display has a native resolution of 1280 × 800 pixels.

Native 1280 x 800

When I select a different display resolution, it is stretched to fit the screen. This may distort the aspect ratio. It also looks like crap.

Stretched 800 x 600

Scaled modes are available. These preserve proportion, but they still look like crap.

Scaled 800 x 600

Why not use an exact subsection of the screen? I don’t think my display can do this, but it seems like the most logical solution. Who wants the crappy scaling?

Centered 800 x 600

Are there any LCD monitors that work like this?

Posted on Wednesday, July 4th, 2007.

PSA: Mac OS X Keyboard Navigation

Open the Keyboard & Mouse pane of System Preferences and click the Keyboard Shortcuts tab. Select the “All controls” keyboard access option.

Keyboard and Mouse - Keyboard Shortcuts - Full Keyboard Access screenshot

Now you can use the tab key to select every last popup menu, button, and checkbox. The selected interface element is indicated by a halo, like the one surrounding the “Where” menu in the following screenshot.

Keyboard navigation halo

Invoke the active element by pressing the space bar or, in some cases, the arrows. (In this case, pressing space will display the menu. As with all menus, you can use the arrow keys to select items – or just begin typing to select matching item names.) The return and escape keys retain their usual function.

Posted on Wednesday, July 4th, 2007.

Expanded Yojimbo Comment Fields

This hack tweaks Yojimbo’s bookmark, serial number, and password editors so that their comment fields expand to fill the remainder of the item pane. Before and after:

Original Bookmark Comment Field Expanded Bookmark Comment Field

Download Expanded Yojimbo Comment Fields (33k) for Yojimbo 1.4

Download Expanded Yojimbo Comment Fields (34k) for Yojimbo 1.5.1

The download contains three modified Nib files and a readme explaining how to install them. Proceed at your own risk.

Posted on Monday, May 21st, 2007.

Save Selection Service

The Save Selection service allows you to immediately save the selected text in any application. When you invoke the service you’ll be asked where to save the selection. That’s it! No need to copy and paste into a separate text editor.

Download Save Selection Service 1.0 (33k)

The service file goes in ~/Library/Services/ and is invoked from the Services submenu of the application menu. Here is the AppleScript source code:

on process(_selection)
 tell application "System Events" to set _appname to the name of every process whose frontmost is true
 tell application (_appname as string) to set _file to choose file name with prompt "Save the selected text as:" default name "Selection.txt"
 set _fp to open for access _file with write permission
 write _selection to _fp
 close access _fp
end process

This service made with ThisService.

Posted on Sunday, May 20th, 2007.

Bookmark in Yojimbo 1.2

A new version of my Bookmark in Yojimbo script is available. It now checks for duplicate bookmarks and is compatible with Firefox. I use this daily.

Posted on Friday, May 11th, 2007.

Backdate Yojimbo Import

When you use this script to import files into Yojimbo, the imported items are automatically assigned the creation and modification dates of the original file (Yojimbo normally records the date of import as the creation date for imported items). Now you can easily preserve the chronological relationship between imported files.

This script is based on the similar Backdate Yojimbo Items script I wrote a few days ago, which is better for isolated corrections than bulk backdating. The same warnings about unsupported database manipulations apply.

Download Script: BackdateYojimboImport.scpt.zip (13k)

Download Droplet: BackdateYojimboImport.app.zip (35k)

Both versions work exactly the same, except that you can drag files (or folders) onto the droplet icon to import them (or their contents). The droplet appears in the Dock when invoked, whereas the script version runs transparently. A good place to install the script is ~/Library/Scripts/Applications/Yojimbo/.

When you invoke the script, a file chooser will appear. You can select multiple files to import by Shift- or Command-clicking. (If you would rather select folders, look at the code. It is a trivial change.) The backdated timestamps will not appear in Yojimbo until you restart the application.

Posted on Wednesday, May 9th, 2007.

Backdate Yojimbo Items

An issue that has recently arisen on the Yojimbo mailing list is that imported items are considered created at the time of import. This is logical, but some people would prefer to retain the creation date of the original file. Enter “Backdate Items,” an AppleScript for Yojimbo that gives you the ability to change the creation date of existing items:

Backdate Yojimbo Items Dialog Screenshot

A word of warning: this script modifies Yojimbo’s database directly using sqlite3. This is quite certainly an unsupported way to manipulate your data. In fact, Apple clearly states that Core Data files like this should not be tinkered with:

While it is easy enough to look under the covers and see what is going on with the XML and SQLite data formats, you should never modify the data in these files yourself.

But I tinker. If you do, too, please back up your ~/Library/Application Support/Yojimbo/Database.sqlite file first. Consider yourself warned that this script could potentially mangle that database.

Download Backdate Yojimbo Items Script 1.2 (11k)

Install the script in ~/Library/Scripts/Applications/Yojimbo/. Usage:

  1. Select some items in Yojimbo’s list pane.
  2. Invoke the Backdate Items script.
  3. Enter the desired date and time in any supported format.
  4. Click “Creation” or “Creation & Modification” to reset the corresponding timestamps.
  5. Changes will not be visible until you restart Yojimbo. You may backdate more than once before restarting Yojimbo, but don’t edit a backdated item until you’ve restarted Yojimbo or your changes may be lost.

Examine the script for more information about how it works. The SQLite Database Browser can also be used for this purpose, but you’ll have to manually convert dates to seconds since January 1, 2001 00:00:00 GMT (the NSDate epoch). With any luck, the option to preserve creation dates will eventually be added to Yojimbo’s import facility and this hack can be retired.

Posted on Monday, May 7th, 2007.