Posts Tagged: applescript


8
Mar 07

Resize Terminal

Before I switched to Mac OS X, I was using a Sun Solaris machine as a desktop, and fvwm2 as my window manager. Fvwm has a nice feature called “grow window” which lets you grow a window to the full height of the display. This was occasionally useful for other programs, but I used this feature constantly for terminal windows, particularly when writing code. The extra vertical space really makes it easier to maneuver around a file. So when I came to OS X, naturally my first foray into Applescript was to port this feature so I could keep my lovely “tall” terminal windows.

This script will cycle through three sizes:

  • “normal” (default: 80×24)
  • “tall” (default: 80×50)
  • zoomed

If the window isn’t in any of those states, it is set to normal size. The sizes are all customizable by setting property values at the top of the script.

Download resize_terminal.zip


10
Feb 06

iPhoto batch add comments

UPDATE: As the first comment below indicates, one can now do this natively in iPhoto. A little Googling suggests that Apple added this feature in iPhoto 4. So check out the Batch Change feature (found in the Photos menu), it appears to do the same thing that my Applescript does. Actually, it does one thing my script can’t do — it is able to replace comments entirely, if you want, instead of appending to the existing comment.

Thanks to Michael Browne for pointing this out.

(Original post follows…)

I use iPhoto to manage my digital photo collection, but I find its keyword feature to be very difficult to deal with. I wanted a free-format searchable keyword system, not some predefined list of tags I could add to my pictures.

iPhoto has a comment facility so you can put remarks on your images. However, you can only do so one image at a time using a text entry box. When I have a newly imported batch of 200 photos and want to apply the same keyword(s) to all of them, that just isn’t going to work.

Enter Applescript. This script will let you add a random string of word(s) to any selection of images in iPhoto. Simply select the desired photos in your current iPhoto window, run this script, enter your keyword(s) in the dialog box and click OK. The script will run and pop up another dialog when it’s finished.

The script will recognize existing comments and preserve them. If an image has no comment, the keyword(s) are set as the comment. If an image already has a comment, the keyword(s) are appended after adding a space.

Now, I can go to iPhoto, type “hubbard glacier” into my search box, and find all the pictures I took of a particular glacier in Alaska. Voila! And I don’t have a zillion pre-defined keywords in the iPhoto preferences, either.

One final note. If you apply your keyword(s) to a lot of images, it might take a while to get back the final OK window. Don’t worry, Applescript is still working for you. Be patient. On my PowerBook G4 1.25GHz laptop, it can take a couple of minutes to get the result back if I’m marking 200 photos.

DISCLAIMER: Use this software at your own risk. If it does something bad to your iPhoto database, it’s not my fault.

NOTICE: I have used this script with iPhoto 5 and can claim it will work. It has not been tested with iPhoto 6 to my knowledge. If you decide to try it with iPhoto 6, please drop me a note and let me know what happened.

Download iphoto_batch_add_comments.zip


21
Sep 05

Resize Safari

Resize Safari lets you easily switch the front-most Safari window between various common monitor resolutions (640×480, 800×600, and 1024×768). I find this of use to check how a page will display under those common video resolutions.

Download resize_safari.zip