Use DropScript to make a faster OS X PS viewer

Update (2010): this is no longer necessary in Snow Leopard, as X11 starts automatically when you need it, i.e. by typing “gv idl.ps” in the Terminal.

DropScript is a handy tool that allows you to create normal OSX applications from scripts written your favorite scripting language. This becomes even more useful with the X11 updates to Leopard, since any application that needs X11 will launch it itself.

For an example, even though opening PostScript files with Preview is refreshingly simple, the required conversion to PDF takes just a little bit too long if you’re used to the speed of gv. Well, now you can make an application that automatically opens gv if you drop PostScript files onto it (or configure it as the default application). Here’s how to do it (via R. Lupton):

  1. Download DropScript and unpack it.
  2. Make a text file named “gv.sh” with the following shell script. Note that you need the directory where gv lives to be included in your PATH. Mine is in /sw/bin. Run which gv and adjust the lines in the script accordingly.
    #!/bin/sh
    PATH=/sw/bin:$PATH; export PATH
    /sw/bin/gv "$@" &
  3. Drop the “gv.sh” file you just made on the DropScript.app.

That’s it. Now you have an application named “Dropgv” that will pop open gv when you drop a PostScript file onto it.

P.S. While you’re at it, install the EPS QuickLook plugin that will provide instant previews of PostScript files in Mail, for example.

Advertisements
This entry was posted in Tips and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s