When I used Windows, I really liked PHP manual in CHM format. It features table of contents, index and search. There are versions of the manual with comments that users leave on php.net. These comments are often very valuable because they provide additional pieces of information and users' experience.
When I migrated to Mac, I found that Mac does not have native support for viewing CHM files. I found a free xchm application that can open PHP files. The only problem was that this application does not open recent file on start up and does not have such option.
I missed this option very much. I use PHP manual often but I hate keeping programs open just because I may need them. So I open the program, look up something and close it if I do not use it for long. This behaviour is automatic for me.
But here comes the problem. If I open xchm, I have to go and choose my PHP manual. Loose of time. What do I do?I found that xchm supports command line arguments (the name of the file to open). But how do I run xchm with this file. Just associating chm files with xchm does not work for some reason. After thinking I resorted to the AppleScript. I created the following script in the AppleScript editor:
do shell script "open -a \"/Applications/Utilities/xchm.app/Contents/MacOS/xchm\" /Users/myusername/Documents/chm/php_manual_en.chm &"
Next I selected "Save As" in menu and saved this script as application named "PHP manual". I clicked on the application in Finder and chose "Get info". Next I dragged xchm icon to the application icon. Now my application got a nice icon. I can use to quickly run PHP manual.
Here is how it looks in the Dock stack dedicated to my development tools:
AppleScript is a great thing. Probably I should buy a book about it.