Applescript glue; dropplet magic

Norm wrote a super perl script to ensure that when you open iCal files sent to a mailing lists it uses the correct to address. This avoids having to have all the mailing list addresses in your own card in your address book. However he did note that OS X doesn't allow you to set a perl script as a file action. So it is impossible to open ics files with the perl by default.

After some googling I came up with this Applescript. It's a small 'droplet' which takes a file input and then calls the perl function after translating the path into POSIX for it. This script is great to act as glue between the GUI and CLI applications.

APPLESCRIPT:
  1. on open icsFileRef
  2.     set icsPath to quoted form of POSIX path of icsFileRef
  3.     do shell script "perl /Applications/AppleScript/Scripts/fixics.pl " & icsPath
  4. end open

Apple have a more complete description of how to write out dropplets to handle things like multiple file types and folders and nested folders etc. I like the idea that you could make a launcher droplet in applescript which would then exectute whatever else you wanted for each file type, context, etc.

Technorati Tags:
, ,

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • DZone
  • Ma.gnolia
  • MisterWong
  • Reddit
  • scuttle
  • Slashdot
  • SphereIt
  • StumbleUpon
  • YahooMyWeb
  • Wists
discussion by DISQUS
Add New Comment