Sal's AppleScript Snippets


Index Page
Here are sets of utility scripts meant for use with OSA Menu. Install OSA menu and place these scripts in the Universal and Finder scripts folders in the Scripts folder in the System folder.

If you are using OSA Menu 1.1 which has popout menus, place the Disk Copy and Websites... folders inside the Universal scripts folder.

Download the Utility Scripts


Universal Scripts
Process a File... - This script will automatically switch to the Finder, prompt you to first select a file from a dialog and then pick a destination folder via a second dialog. You will then have the option to either:

  • 1) MAKE AN ALIAS of the selected file to the destination folder
  • 2) DUPLICATE the selected file to the destination folder; or
  • 3) MOVE the selected file to the destination folder.

When the script has completed, it will automatically switch back to your previous application and beep twice.

Process a Folder... - This script will automatically switch to the Finder, prompt you to first select a folder from a dialog and then pick a destination folder via a second dialog. You will then have the option to either:

  • 1) MAKE AN ALIAS of the selected folder to the destination folder
  • 2) DUPLICATE the selected folder to the destination folder; or
  • 3) MOVE the selected folder to the destination folder.

When the script has completed, it will automatically switch back to your previous application and beep twice.

Finder - Activate/Hide Apps -- This script will switch to the Desktop and hide all applications in the background.

Finder - Close Win/Hide Apps -- This script will switch to the Desktop, close all windows (except the Launcher window), and hide all background applications.

Finder - Unmount/Eject All -- This script will unmount any non-local drives, disks, and servers unless they are in use.

Finder - Open Folder -- This script will prompt you choose a folder through a standard dialog and then will switch to the Desktop and open the chosen folder.

Quick Note -- This script is an example of how a script can store information for later use. You can store any message of up to 256 characters and retrieve it by running the script later. Since this script has a multiple-line text input field, you must use the ENTER key on the extended keyboard to access the default button.

Disk Copy Scripts - The Disk Copy 6.1.2 application from Apple is scriptable and recordable. It can be used to duplicate disks, make disk images from folders, or mount disk image files as virtual floppies on your desktop. Included are four scripts for this application. Disk Copy 6.1 can be downloaded from the Apple website at:

http://info.apple.com/Apple.Support.Area/Apple.Software.Updates/US/Macintosh/Utilities/

Copy 1.4 MByte Floppy - This script will launch Disk Copy and prompt you for floppy disk to copy.

Folder to 1.4MB Disk Image - This script will convert any folder less than 1.4 MEG in size to a disk image. Once the task is completed you have the option to mount the disk image or make floppies from it.

Make Disks from Image - This script will load a disk image and make floppies from the loaded disk image.

Mount Selected Disk Image(s) - Select one or more disk images and run the script to mount the images as virtual floppies on the desktop.

Finder Scripts -- A collection of scripts to automate some of the more mundane and difficult tasks in the Finder. These scripts also require the OSA menu system extension be installed.

Add Prefix/Suffix to Folders -- This script will prompt you for the location of a folder and for a prefix or suffix to be added to the names of folders within in the chosen folder. For example, you could choose to add the prefix ÒSmith.Ó to the name of every folder within a folder.

Add Prefix/Suffix to Files -- This script will prompt you for the location of a folder and for a prefix or suffix to be added to the names of files within in the chosen folder. For example, you could choose to add the prefix ÒSmith.Ó to the name of every file within a folder.

Info for Selected Items -- This script will post dialogs containing information about selected items on the Desktop. The displayed information includes: kind, date created, date modified, file type, creator code, size, version, name, and whether the selected item is an alias. To use, select some items in the Finder and run the script.

Make Alias of Selected Item(s) -- This script will make aliases of selected desktop items to a chosen folder. Run the script and choose the folder to which you want aliases of the selected items placed.

Size of Selected Items -- This script will post a dialog informing you of the combined size of the selected desktop items. To use, select one or more items in the Finder and run the script.

Trash Selected Items -- This script will move selected desktop items to the Trash and then empty the Trash. USE THIS SCRIPT WITH CAUTION.

Trim "XXX" From Every Name -- This script will prompt you for a folder and then ask for the text wyou want to trim from either the beginning or ending of the file names.

The following scripts require the Jon's Commands scripting addition be installed in the Scripting Additions folder in the Extensions folder in the System folder. Here is the link for this OSAX: http://www.infoworkshop.com/~jonpugh/

Copy List to Clipboard -- This script will prompt you for a folder and then give you the option to list: all the items in the folder, all the files in the folder, or all the folders in the folder.

List of Selected Items -- This script will place on the clipboard, a list of all the names of the items selected in the Finder. The script will beep twice when done.
top of page