Apps In A Day

/ 21 October 2006

I’m sure all of you know about Applescript, Apple’s english-like code language to automate tasks in a deeper way than Automator can. Well, did you know that if you know even just a little bit of Applescript you can create a fully functional OS X application.

Here’s how (it’s quite simple): 1. Insert your OS X install DVD, 2. open the “Developer” folder (at least I think that’s it’s name), 3. Open the primary install .pkg file, 4. Go though the complete installation (takes about 20 min, 1.5 GB), 5. eject the DVD, 6. select from the “Go” menu -> Go to Folder. Type /Developer/Applications, 7. open Xcode.app, 8. set up your environment (on screen instructions), 9. Choose from project menu: “Applescript Application”, 10. you’ll see a large window with multiple files listed; double click the file “MainMenu.nib”; this will open Interface Builder.app, 11. use the palates to make your interface, 12. go back to the first window (the list) and press the command-N keyboard command; now choose “Applescript Text File”; choose a name and press “finish”, 13. in the window that opens type your script; for example make a dialog that says “Testing”; save, 14. go back to your interface and choose one of the buttons you added to the interface; show the inspector and choose “Applescript” you’ll need to check the “Click” checkbox, and then choose your applescript, 15. now go back to that list and press “Build and Go” at the top of t he window; this will compile your interface and script into a normal-looking application, 16. you should be able to press that button and when you do that script should come up; you/ve now made your first applescript application.

A good place to start would be to make an app that opens your most-used apps, the script that you’d use is below: on clicked theObject tell application “Disk Utility” to activate end clicked That script will tell your app to launch (open) Disk Utility.app when the button you decide has been pressed. Obviously you can tell it to launch any application (just replace “Disk Utility” with “…”), but at first you may want to just copy the script above and see how it goes. Enjoy, Alex

Discussion