Skip to content

Category Archives: Code Sample

Adding a Check Updates Feature

This tutorial shows you how to add the Sparkle framework to an AppleScript Studio application using XCode 3.1.

The First Responder: Setting it to a Table Cell

This example project and accompanying explanation shows how to set the first responder (the active cursor) in an individual table cell.

The First Responder: Put a Cursor in a Text Field

This describes how to set the first responder (the active cursor) for a text field.

Adding a Help Book to your AppleScript Studio Application

This example project and explanation shows you how to add a Help Book to your application, thereby activating the help menu.

Reacting to Keyboard Input

This posting and downloadable sample project shows you how to how to react to user keyboard input.

Calling Cocoa String Methods in Applescript Studio

This posting and downloadable sample project shows how to make simple Cocoa method calls directly in AppleScript Studio.

An AppleScript Replace Text Method

This posting offers a replace text method written by Bruce Phillips.

Tell a Button to Trigger a Menu

This posting explains how you can get a button to trigger a menu item when pressed using the “perform action” command.

Search a String: Offset

This posting introduces the applescript “offset” command for searching strings.

For Loops in AppleScript: Repeat

This posting introduces the way to create loops in Applescript.

Responding to a Chosen Menu Item

This posting demonstrates how you can respond to a chosen menu.

Responding to a Clicked Button

More basics. After you create an button in Interface Builder, in the last tab of the inspector give it a name, select the applescript in your project where you will be adding the script for the button, and then give it an event handler by checking Action: Clicked in the list of possible Event Handlers […]

Change the Contents of Text Fields

This is pretty basic, but we all need to start somewhere. To change the contents of a text field (any NSTextField, including Labels), simple issue this kind of command: set contents of text field “myTextField” of window “myWindow” to “Hello, World.” Make sure the “name” (not the “title”) of your target object (in this case […]

Center a Window

Found a useful posting at Coding AppleScript on centering windows in AppleScript Studio. tell every window to center I used this tip to figure out how to automatically center my splash window when the application first opens: on will open theObject if the name of theObject is “homeWindow” then tell theObject to center end if […]