Open iPhoto Selection in Photoshop - Simple script that just opens the selected pictures in Photoshop.
AppleScript to "Delete All" from Mail's Current Mailbox - I often find myself cleaning out multitudes of unread mail and spam by constantly just selecting all in a mailbox in Mail and deleting it. This simple script uses a handler available at AppleScript > Applications > GUI Scripting to do the task in two clicks. I started with no deletion warning, but had occasion to prevent the accidental deletion of a message and figured it would not hurt.
Set iChat icon and status message - This simple script allows the choosing of a TIFF file for an icon and the setting of a status message in iChat. Good for quickly setting these for amusement or information. This provides a basic script that can be substantially expanded to many possibilities of different settings. Save as a compiled script in Home > Library > Scripts > Applications > iChat and it will be available from the menubar scripts menu.
A Calculation in a BBEdit Replacement AppleScript - I converted the Game Schedule of the San Francisco Giants to a list of records so that I could add it my Entourage Calendar. But, since I got the game list from Yahoo, the times were Eastern Time Zone. So I created the following script which repeats until the find string is not found. Once it finds an instance, the hour is coerced from text to a number and then three is subtracted from it. Then the replacement string is created and substituted for the found text. In about 6 cases, a negative number was created. This could have been accounted for, but since it is a one time script, I just fixed the negatives in another find and replace.
PDF Workflow: Combine Multipage PDF into One Photoshop Document - PDF Workflow allows various methods of processing items that have been printed from applications as PDF files. The following script open a 2, 3, and 4-page PDF in Adobe Photoshop. The resulting pages are then combined into one document side-by-side. The script asks for an output folder and then the number of pages in the PDF. The resulting file can then be merged and saved as appropriate.
Quit Every App - Here is a script that quits every running application except the Finder.
Another Method of Getting Image Info in Safari with AppleScript - In the following script, an image must be the open in the front window of Safari. One method is to Control-click an image in a web page and another is to drag and drop the image into the browser window. The run this script. If the image is a remote file, a copy is downloaded to the temporary items folder with the cURL shell command. If the image is local, the local copy is used. The script will obtain the width, height and data size of the image by using the Image Capture Scripting Scripting Addition and display it in a dialog box. Click on "Copy to Desktop" will copy the file from it current location to the desktop with the cp shell command.
Extending the Script Editor 2 Beta with Context Menu Scripts - One of the interesting aspects of the Script Editor 2.0 Beta is the improved capability of using AppleScript itself to enhance the creation of scripts. Once the beta is installed, control-clicking in a script document will bring up a context menu that includes scripts. These scripts are located in /Library/Scripts/Script Editor Scripts/. The default installation includes many sample scripts that insert Action Clauses, Conditionals, Tell Blocks and other routines.
Six More Scripts for Safari Beta - Here are six more assorted scripts for use with Safari Beta. Safari URLs and web page information are downloaded and sent to Stickies, iCal, and Internet Location files for various purposes.
Five Scripts for Safari Beta - Here are five assorted scripts for use with Safari Beta. Each contains different parts and elements that might be useful in creating other scripts that would be useful, as well. Safari URLs and web page information are downloaded and sent to Entourage, iChat and BBEdit for various purposes.
Saving Properties Between Launches of a Studio Application - With AppleScript Studio 1.2, you can pretty easily read and write user defaults in a plist and it is quite similar to the old properties behavior found in "classic" AppleScript. Here some examples from a Quicktime controlling app I have been working on. The defaults that are stored are the selected item in a pop up menu, the selected of two radio buttons and whether a check box is clicked or not. The stored defaults are read when the "awake from nib" handler is called and written when the application is quit.
AppleScript: Reading and Parsing Tab-delimited Text Files - Parsing the tried-and-true tab-delimited file with AppleScript is very easy and creates lists of lists that are pretty easy to access. Using tab-delimited files is important because it is such a common data exchange format. Spreadsheets, contact databases, HTML tables, other database and many other applications export their data as tab-delimited text files. An example is a selection of our digitallyOBSESSED! DVD review database. There are seven return-delimited lines with six fields separated by tabs. The fields are DVD title, Studio, Stars, Other Stars, Quote from the movie, who said it, and Genre.
Logging in AppleScript Studio - Studio doesn't have an Event Log window (like Script Editor) and you can't turn logging on and off. However, there is a log command you can use to log values in your app. The output goes to the Console pane of the Run tab if you run the application from Project Builder or to the Console application (in /Applications/Utilities) if run from the Finder. Here's a couple of examples in a clicked handler:
AppleScript to Send a SMIL File from BBEdit to Quicktime Player - This script can be compiled and saved into the BBEdit scripts folder. Then, when run will send a SMIL file to Quicktime Player for viewing. Handy when writing SMIL code. If Quicktime opens with a little black screen and your SMIL code is in the window then you have a syntax error. Below is a SMIL document for trying it out. It includes some Quicktime specific SMIL extensions and also some of the text descriptors used to "markup" text for display in the Quicktime Player. Copy the document below and paste it into a text editor. Save it with a .smi extension and open it in the Quicktime Player. More information can be found at: Quicktime and SMIL
Creating a Layered Photoshop File from Frames of a Quicktime movie - Sometimes, a frame or frames from a Quicktime Movie are needed for some processing such as making a thumbnail or creating an animation. The following script uses the scriptability of Quicktime 5 and the new scriptability of Photoshop 7 to grab a frame or frames from a Quicktime Movie and add them to a layered file in Photoshop. First, navigate in the Quicktime movie to the frame to transfer. Then select the script from the Script Menu. Quicktime Player grabs the height and width of the frame, the current time of the movie and copies the frame to the clipboard. Photoshop then checks for an existing document, and if none is found, makes a new one. If a document already exists, then a choice is offered to either create a new document or use the existing one. The layer receiving the frame is named with the time stamp of the original frame from the Quicktime movie for reference and the frame is pasted in. There is a place in the script for adding calls to Photoshop actions to further process the layer. The script then asks if another frame is required and, if so, switches back to Quicktime Player to allow for grabbing multiple frames, putting each in a new layer of the Photoshop file. The file can then be opened in Image Ready (using the Jump To menu command) and the layers distributed to frames in an animation.
Cycle Finder Windows - I saw a one-liner on MacOS X Hints about cycling Finder windows. I wanted something a little more that would allow me to show all my minimized windows and cycle through them from a script in the Script Menu. When launched it will present a dialog that has the buttons "End," "Show All", "Cycle." By pressing return, you will cycle through all open Finder window. When the window you want is found, click on "End" and you will be in the Finder, with your chosen window active.
Search the Online Dictionary of Computing - This snippet is desinged to create a search capability of the Online Dictionary of Computing. The handler is in the script will work with the Big Cat Plug-in from Ranchero Software. But the code is easily reusable for many situations.
RTF About Box in AppleScript Studio Application - From the AppleScript Studio list: A scripter asked about using an RTF file as his customized "about box." He noted that the AppleScript application, by default does not include an RTF file like the document-based application does. The solution was provided on the list.
Make a script (Shell or Perl) executable - Two versions of the script are provided. The first script provides a quick way of making a Shell or Perl Script executable from the Script Menu. An open handler can be added to allow drag and drop of script files. If there is a problem, an alert allows the opening of a Terminal window in the folder that contains the script. The second script is written for the BBEdit Scripts menu. Once a Shell or Perl script is written in a BBEdit window, this script can be run. It will check that the document is saved and check for unsaved changes. If these are true it will change the permissions on the script file. If there is a problem, a dialog will provide the option of view a directory list in a BBEdit window or in the Terminal.
AppleScript Studio: Creating a Droplet Application - These are some sample steps for creating a Droplet application in AppleScript Studio. This application will examine the file information for any files dropped on it and display a dialog containing some of it. Begin your project with an AppleScript droplet. You can add an 'on launched' handler to your script. In Interface Builder deselect "Visible at launch time" (for your main window) in the info palette. If the droplet is double clicked, the InternList will be empty and your main window be shown. If something is dropped on the script, the variable InternList is not empty any longer and the main window stays hidden.
AppleScript Studio: Making a New Nib File - These are the steps for adding a new nib file to an AppleScript Studio project.
AppleScript Studio: Populate a Popup Button from a List - This script snippet will populate a Popup button from a list in AppleScript Studio
Get Source from Internet Explorer to BBEdit - This script will take the source of the front window in Internet Explorer and open it in BBEdit.
BBEdit GREP Text Cleaner - This script can be compiled into a droplet that will allow you to drop files onto it. It will use BBEdit's GREP capability to find and replace on all the files. Useful for cleaning up strange characters in text. Put two string here between the quotes: replace " " using " " - first the string to replace and then the string to replace with in your document. You can copy and duplicate this line to allow for more than one replacement. At the end, before saving the file, this script changes the linebreaks to Unix.. this can be changed to Mac or DOS, depending on your needs.
Making a New Task from Anywhere in Entourage - Here is a script made for the Script Menu in OS X, which allows you to make a new task in Entourage from any application. I often have to need to make a quick task based on what I find on a web page or from a phone call and have found it a pain to switch applications and get the task going. This has a series of dialogs for the settings and a list choice for category.