10.4: A simple Widget installation AppleScript

Jun 06, '05 08:32:00AM

Contributed by: Anonymous

Tiger only hintI had been using an automator script to install my downloaded widgets, but wanted to delete the zip file which the widget came in at the same time.

So I created this short AppleScript to do the job. It probably could be improved (it only deletes the zip file if it has the same file name as the widget, but with .zip on the end), but I'm pretty new to AppleScript):

tell application "Finder"
  set selectedFile to (get selection)
  set filePath to (item 1 of selectedFile as text)
  set zipFileName to filePath & ".zip"
  if zipFileName exists then
    move zipFileName to trash
  end if
  move selectedFile to folder "Widgets" of folder "Library" of startup disk
end tell
[robg adds: If you use Safari, these steps are usually automated. But this script could save some time if you use a third-party browser that doesn't install widgets automatically (or if you've disabled the feature in Safari).]

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2005051419351693