
Version 1.9
December 4, 2007
OnMyCommand is a UNIX shell script and AppleScript executor. You can
build your own Contextual Menu Item or GUI application.
For more information on building command descriptions see Command Description Manual.
Sources are included with Contextual Menu Workshop. Newest sources are available on request.
Subscribe to OMC mailing list to receive OMC-related announcements, seek support, suggest features or discuss command descriptions.
What people say about OnMyCommand
- If you want to learn what users think about it, please see
comments at VersionTracker.
- You may want to check MacUpdate
too.
- David Kadavy wrote a hands-on introduction to OMC with example commands.
- A nice "Getting started" tutorial by Ross McKillop.
- If you speak French, a good introduction to OMC was written by
Fabien Conus. Read it here.
- Yet another article in French is here.
DOWNLOAD LATEST VERSION:
OnMyCommand.dmg.gz
Version History
1.9 (Download)
- Reimplemented popen with OMC's own version: omc_popen()
- Added POPEN_SHELL for customizing the shell (and flags) executed by popen
- Added environment variable export for popen-based execution modes: __OBJ_PATH__ becomes "$OMC_OBJ_PATH" and so on
- STANDARD_INPUT_PIPE - allows piping of context information to a tool excuted in COMMAND
- Added new activation option: checking file name, path or selected text for a match
- Mac OS 10.5 compatibility: Terminal.app lost its creator code ('trmx') so it must be identified by its bundle id (com.apple.Terminal) when sending AppleEvents
- Mac OS 10.5 compatibility: recompiled to support loading in Garbage Collection-enabled applications
- Fixed versioning code in OMC to support Mac OS 10.4.10 and higher
- Fixed a problem that error returned from script should stop all post execution actions
- Fixed menu separator problem in dialog popup menus (was showing as "-" instead of real separator)
- Worked around a bug in Core Foundation related to bundles
- Fixed a crash when executing empty command with popen
- Online command collection contains over 560 commands.
1.8 (Download)
- Some execution modes are now asynchronous: the host application is no longer blocked during command execution and can be responsive. The default popen() execution mode is now asynchronous.
- Added task manager with an option to specify maximum number of concurrent tasks
- Added progress dialog
- Added task end notification. Many tasks execute asynchronously now so the end notification is useful.
- Fixed a problem with AppleScript executor ignoring handlers/subroutines defined after main script (long standing issue).
- Added DataBrowser control (list view) support for nib dialogs. This allows creation of dynamic lists and tables
- Item name upgraded to array of strings with special objects to allow dynamic names
- NAME_PLURAL key defined so the menu name may be different when more than one file is selected
- Standard default location for external ".omc" modules: ~/Library/Application Support/OnMyCommand/
- DropletBuilder updated to install .omc modules; also validates droplets before upgrading
- Output window fade in and fade out re-implemented using Apple API for smoother effect
- Implemented dragging of custom output window if the click is outside of "close" rectangle
- New method of output window positioning
- Option to show invisible files and folders in navigation dialogs
- Option to set default location for navigation dialogs
- CommandDroplet navigation dialog displayed on startup now allows multiple objects
- Reimplemented input dialog using nib dialogs
- iTerm startup shell support
- Non-blocking nib dialogs
- Termination handlers for nib dialogs (analogous to dialog initialization handler)
- New properties for text view control in nib dialogs: text font and size
- Added initial keyboard focus for text fields in nib dialogs
- Ability to override escaping method in nib controls
- Added new escaping method: esc_with_percent_all
- Bug fix: escape FRONT_APPLICATION_NAME according to current escape method
- External bundle special word: __MY_EXTERNAL_BUNDLE_PATH__
- Expanding tilde in EXTERNAL_BUNDLE_PATH and REFRESH_PATH
- Added statically assigned next command id
- Multiple objects sorting
- plister tool updated with new commands: find, findall, iterate; "get string" & "find string" may now be used on arrays and dictionaries
- b64 tool with new i/o options
- added new examples
- Knut Lorenzen updated OMCEdit to support all new features
1.7.2 (Download)
- Re-enabled Mac OS 10.3.9 support
- New feature: modify command ids of nib dialog controls on the fly
- New droplet preference: "Run main command when reopening"
- Bug fix: quit command handled in droplets when nib dialog is shown
- DropletBuilder is now able to update existing droplet to the newest OMC engine.
1.7.1 (Download)
- Universal binaries
- New ESCAPE_SPECIAL_CHARS option: esc_wrap_with_single_quotes_for_shell
- New option for output window auto close: AUTO_CLOSE_ON_SUCCESS_ONLY
- New method of dynamic menu population in nib dialogs with omc_dialog_control tool by reading items from file or standard input: omc_list_append_items_from_file and omc_list_append_items_from_stdin respectively
- Updated plister tool to print array and dictionary values when using "plister get value ..." command
- New Beginner's Tutorial
1.7 (Download)
- Multilevel submenus in contextual menu
- Output window auto close timeout.
- Support for adding and removing popup menu items at runtime (in
nib dialogs)
- Default filename for "Save as" dialog
- Default text with objects for input dialog
- New special words: __FRONT_APPLICATION_NAME__ &
__FRONT_PROCESS_ID__
- Categories
- Version requirements checking
- Disable/Enable without removing command from the list
- Additional tools: plister & b64
1.7b1
- Support for sending tasks to background application (OMCDeputy)
- Output windows with custom shape and background defined by PNG
image.
- Fade in and fade for output windows.
- Subcommands. Subcommands use the same command description format
but use a special command identifier
- Next command can be scheduled with "omc_next_command" CLI tool so
your script can decide at runtime if another subcommand should follow.
- More controls supported in nib dialogs, including pictures,
icons, bevel buttons, static text, progress controls, tab control.
Controls can trigger subcommands
- "omc_dialog_control" command line tool to set control values in
nib dialogs
- Nib dialog initialization with subcommand
- Support external bundles for putting nibs and custom window PNG
images outside of the main bundle
- Option to replace line endings for __OBJ_TEXT__
- Send text to Terminal as a 2 byte Unicode for much better support
of non-ASCII characters.
- __DLG_INPUT_TEXT__ is now escaped according to the escape method
described by ESCAPE_SPECIAL_CHARS
- Enhanced Droplet Builder with support for custom application
icons. Icons courtesy of Scott Chitwood
- Some execution errors are now printed to Console so it is easier
to debug a command.
1.6.1
- Full support for shell scripts. Finally you can use perl, python
or other scripting language directly in your command.
- New activation option for contextual menu to tell in which
applications the command should or must not show.
- Dialogs may now be built directly in Interface Builder and
control values are easily accessed in command description.
- Included DropletBuilder application for easy droplet application
creation and upgrading incomplete ".droplet" stubs to full apps.
- Fixed a bug involving text selection and a dialog in Carbon
applications in Mac OS 10.3
1.6 (Download)
- CommandDroplet - small application executing OMC commands. You
can create standalone applets using the same command description format.
- Direct AppleScript support. You can put AppleScript code into
command description, no need to go through osascript call.
- Output window to see the result of command execution. In many
cases it eliminates the need to send the command to terminal.
- An option to paste clipboard content after command execution.
Most useful in text context with pbcopy or AppleScript's set
the clipboard to...
- Bug fixes. Most important fix involves a long standing bug with popen
execution mode aborting some commands. Now you should be able to
execute almost anything in popen mode.
- Knut Lorenzen's OMCEdit is now included with the main OnMyCommand
distribution.
- Discussion forums. Some users expressed interest in having a
place to discuss command descriptions.
- BlackTree's QuickSilver now supports OMC commands as actions. You
can download the plug-in for QuickSilver here.
Give it a try!
1.5.6 (Download)
- Worked around a problem with objects in Finder's column view in
Mac OS 10.3.
1.5.5
- Internal changes for Mac OS 10.3 Panther compatibility.
1.5.4
- Extensive reorganization of special words: dialog words now take
form of __DLG_XXX__. Old style names are still recognized for backward
compatibility but are not recommended.
- Three new Navigation Services dialogs have been added: choose
file, choose folder and choose object (file or folder)
- Two new execution modes have been added: silent execution using
system() call and terminal execution using iTerm.
1.5.3
- Added "Save As..." dialog. The path chosen with "Save As..." can
be passed to CLI as a command argument.
- New dialog type for input text is added: combo box. The dialog is
shown with edit field and popup choice. Handy for pre-defined items but
allows entering custom value.
- Fixed a problem with "text in clipboard" context when a selected
text was always preferred even if the context was explicitly "clipboard
only".
- Changed the behavior of "Always" context. Now always means truly
always, no matter what is the context. Any application supporting
contextual menus will display the item. However, this exposes
contextual menu bugs in some applications (Camino, Safari, possibly
others). Please read the "Known Problems" section for details.
1.5.2
- Fixed a bug which caused strange problems in Carbon applications
(CodeWarrior or BBEdit Lite). The symptom was that all controls,
including scrollbars, were grayed out after contextual menu was invoked
on empty text selection. Thanks to Jayson Adams for providing a quick
solution. This bug was introduced in version 1.5.
1.5.1
- Fixed a bug which caused a crash in Internet Explorer. This bug
was introduced in version 1.5. Thanks to Ira Ruben for reporting this
problem. This is a recommended upgrade since this bug may show in other
programs as well.
1.5
- Text selection now works in Cocoa applications thanks to the code
submitted by Cocoa guru Jayson Adams of Circus Ponies Software.
OMC features in a nutshell:
- You can create a contextual menu item using UNIX CLI or
AppleScript.
- You can control menu behavior via editable command description.
- You can control if a command is to be executed silently, in
terminal or with result in output window.
- You may add a path to the clicked file or folder as an argument
of your command.
- You may add a selected text or text from clipboard as an argument
of your command.
CommandDroplet
CommandDroplet is a small application executing commands in OMC format.
You may use the same command description for contextual menu and for a
standalone applet. CommandDroplet contains exactly one command
description in its resources. Objects in __OBJ_XXX__ family are
obtained from files dropped on CommandDroplet. Text selection objects
cannot be used with CommandDroplet (but clipboard content can be
accessed). More detailed information on droplets here.
OMCEdit
A command description editor is available as a separate application.
It is called OMCEdit and is written by Knut Lorenzen (Knut.Lorenzen
at t-online*de).
Great thanks to Knut for devoting his time to this project.
OMCEdit is a great companion to OnMyCommand and you are encouraged to
download it and try. It is free too.
Please note that this application is not written nor supported by
Abracode, Inc. You can download OMCEdit here.
User contributed command descriptions
Users are encouraged to submit command descriptions via OMCEdit so they can be shared with
other users here.
Known problems
- Terminal in Mac OS X 10.4 prints some warnings about .scriptSuite to Console when AppleEvent is used to launch it. It is not the problem with OMC but with Terminal. It can be reproduced in Script Editor by quitting Terminal and running the following simple script: tell app "Terminal" to activate
This bug was fixed in Mac OS 10.4.7 but then reappeared in 10.4.8 & 10.4.9
- If you choose "Always" for activation mode, the item will always show in all applications supporting contextual menus. But it may also show in unexpected places, especially in some menus in Cocoa applications. It is a long standing problem in Cocoa framework which does not really support contextual menu plug-ins.
- When you execute AppleScripts you must take care not to send events to the application currently executing the contextual menu. For example: if you control click in Finder and execute AppleScript which sends events to Finder, you may end up locking Finder. This happens when the script is executed in synchronous mode, blocking the host application during execution.
You should send the command to background application (OMCDeputy) for execution or use osascript in popen excution mode (OMC 1.8 or higher). When executing osascript in silent system mode, you need to add ampersand at the end of your command (background execution) and this will prevent hanging of the host application. See command 223: "Set As Background" for sample usage (workaround found by Fredrik Andersson).