I have included an AppleScript application called a "droplet" which allows Jmol to feel more like a native application on Mac OS X. This means that file types can be assigned to Jmol. An example of this is included in Jmol.app/Contents/Info.plist where each entry in CFBundleDocumentTypes has been exported by something else, but the exported types can be included directly in this Info.plist (e.g., org.jmol.state).
The AppleScript (Jmol.app/Contents/Resources/main.scpt) works by directly running jmol using the "do shell script" command. This behaves identically to the previously supplied shell scripts. Alternatively, Jmol.jar (and the others) can be included directly into the Jmol.app directory without the need to have Jmol previously installed elsewhere. This means that Jmol.app can live anywhere on the file system and always know how to find the jar since AppleScript understands "path to me" as the absolute path to the Jmol.app directory at runtime.
One thing to note is that when running, the droplet itself is not shown in the Dock. This is because Info.plist specifies
I did this because the java instance also has a dock icon when running and I give it the Jmol icon with the flag "-Xdock:name=Jmol -Xdock:icon=path/to/jmol.icns" It is important to note that Jmol.app can be REPEATEDLY opened and a new java instance will appear in the dock. Note also that if Jmol.app is in the dock another Jmol icon for the java instance appears when Jmol.app is opened.
How to open Jmol:
1. double-click Jmol.app
2. double-click a file whose type is included in CFBundleDocumentTypes and where Jmol is the default application
3. right-click a file and "open with..."
4. drag a file over the Jmol.app icon either in the Finder or the dock
5. in the Terminal run "open -a jmol somefile.ext"
After one of the 5 steps above, the user can continue to use the Jmol open and save dialog boxes or drag a new file over an active Jmol window.
Log in to post a comment.