CONFIGURING CONTEXTUAL MENUS ON OS X
SHORT TUTORIALS ON ACCESSING UNIX
THROUGH CONTEXTUAL MENUS




HOME  AUDIO CD BURNING  PUBLISHING  INTERNET  HTML TOOLS  GRAPHICS  UTILITIES 

     

Configuring OMCEdit-E

Automating Audio Conversion

Assessing Compression Utilities

Encoding Movies


Assessing Unix Through Contextual Menus

One of the most indispensible freeware applications to appear on the OS X front is a contextual menu plugin called On My Command, which, along with its companion app, OMCEdit_E, allows the intrepid user to access the power of unix and even applescript from contextual menus. No more messing around with nasty unix commands with their convulted arguments. Now you can run all your unix through the convenience of a contextual menu. Control-click on the file which you wish to process with a unix command and everything is accomplished for you.

Configuring OMCEdit_E

First we need to configure On My Command using OMCEdit_E, which isn't that hard. When you open up the application, you will get a tableview showing a list of your contextual commands. Click on the "New" icon in the toolbar to bring up the "Edit Command" window. Here's an example screenshot: 

ocmedit screenshot


In the top left corner, there is the textbox where you enter the name of your command—the name that will show up in your contextual menu. Under "Location" you can choose where in the menu to put your command. You can also choose, under "Execution mode," where to run your command: as a system process, as a shell process in the terminal, or as an applescript. Word to the wise: use the terminal. If run as a system process you won't be able monitor the results of the command, or easily debug the process if something goes wrong.

The main text window is where you put your command. In the screenshot provided above, a command which converts mpeg files to dv using ffmpeg is provided. Note that I have created a submenu called "Video Tools" for the command. I have also set it up so that the command only shows up when I click on a file. (See the "Activiation Mode" popup menu.) You can even specify which file extensions will active the command in the contextual menu (hint: click on the file tab in the tabview at the bottom half of the application).

 

 Automating Audio Conversion

In unix, there exist a number of powerful audio conversion utilities, including lame and sox. Here is a very simple OCMEdit_E command to convert an aif to a wav file:

sox __OBJ_PATH__ __OBJ_PATH_NO_EXTENSION__.WAV

To convert an mp3 file to wav format, try the following:

lame --decode __OBJ_PATH__

The variables in the capital letters can be accessed by clicking on the "Add Object" button.

What if you want to convert a file to Apple Lossless. There exist no command-line programs to accomplish that. Either you have to use Quicktime Pro or iTunes, both of which are cumbersome. But with an applescript, you can use On My Command. Download the TO_ALAC applescript here, place it in your /Applications folder, and enter the following command in OCMEdit_E:

open -a TO_ALAC.app __OBJ_PATH__

Assessing Various Utilities

One of my favorite features of OS X is the ability to zip files from the contextual menu. However, as it turns out, zip is not the best compression utility available to Mac users. Both the commercial Drop Stuff and bzip2 provide better compression. With On My Command, you can make these tools availabe in the contextual menu along with zip. With Drop Stuff, the following command will do the trick:

open -a DropStuff.app __OBJ_PATH__

With bzip2, things get a bit more complicated, because bzip2 refuses to compress folders. So we must create two commands, one for single files and one for folders:

bzip2 __OBJ_PATH__

That was easy enough. Now for folders:

cd __OBJ_PARENT_PATH__
tar -bzip2 -cf __OBJ_PATH__.bz2 OBJ_NAME

If you're wondering about the "cd" command, just try it without it and then uncompress the resulting bzip2 file! Incidentally, if you don't want to run that in the terminal, select "Silent (system)" from the "Execution mode" popup and enter the following, all as one line, below the tar command:

osascript -e 'tell Application "Finder"' -e 'display dialog
"Compression of file by bzip2 is complete!"' -e 'end tell'

This will create a display dialog when the compression process is finished

One of the more annoying shortcomings of OS X is that there is no easy and convenient way to erase rewritable media in the Finder. With On My Command, this defect can finally be remedied. Using hdutil or cdrecord, we can easily come up with a command-line erase solution that can be run through a contextual menu. My personal preference, however, is to use a cocoa GUI, as follows:

open -a erase.app

This command calls forth an erase panel application, which can be found here.


Encoding Movie Files

Sorry, not completed.





—Last updated January 4, 2006