Friday, May 9, 2008

Control Any Mac Program

Now, you might be asking how Salling Clicker can support so many applications. Can it support any other applications that you want to control? The answer is probably yes.

A key feature of Salling Clicker is that it can invoke any AppleScript on the Mac. This allows it to potentially launch and control any program on the Mac. In fact, many third-party Salling Clicker scripts are available. They control everything from professional audio applications to telescopes. You can see a list of contributed scripts at http://homepage.mac.com/jonassalling/Shareware/Clicker/scripts20/index.html.

AppleScript is a scripting language on Mac OS 9 and OS X. It not only interacts with the operating system to launch and stop applications, but it also interacts with the applications themselves to provide specific services.

In the Salling Clicker control console in System Preferences, you can edit the controller categories and their associated AppleScripts.

You can click any AppleScript in the righthand column and open it in the system's AppleScript editor. The following listing shows the AppleScript to start and pause the DVD Player. It uses the SEC Helper application to display large gray alert messages on the Mac screen.

tell application "DVD Player"
if dvd state is playing then
pause dvd
tell application "SEC Helper"
show screen message "DVD Player" icon pause
end tell
else
set viewer full screen to true
activate
play dvd
tell application "SEC Helper"
show screen message "DVD Player" icon play
end tell
end if
return
end tell

By inspecting those source code files, you can learn the basics of AppleScript quickly and get started writing a remote controller for your favorite Mac applications.

No comments: