Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 1.6

COLUMN

Call External AppleScripts

Give the user power

Issue: 1.6 (June/July 2003)
Author: Dean Davis
Author Bio: Dean Davis runs AfterTen Software and is the creator of WeatherManX. He believes all programs should have some form of AppleScript interaction, if possible.
Article Description: No description available.
Article Length (in bytes): 4,241
Starting Page Number: 42
Article Number: 1622
Related Link(s): None

Excerpt of article text...

For my last article for REALbasic Developer , I'm going to give away some of my secrets. Actually, the techniques in this article aren't very secret but they are very useful and just about anyone can use them with ease.

Some of my favorite applications are ones that let you run an arbitrary script in response to some event from inside the program. The most common application like this is a "Mail" application like Entourage or Apple Mail. In both of these programs, you can set up "rules" where if a certain condition is met (i.e. Email Sender=mywife@mymail.com) you can then have the program run an AppleScript you have created (i.e. If Email Sender = mywife@mymail.com then run AppleScript "Important Email"). Usually these programs have scripts folders where you are required to put your scripts so the programs know where to find them. I recommend this approach if you are going to code your program to launch user-created scripts.

There are three techniques you can use to have your program run scripts.

The first is the easiest for the programmer but a pain for the user. Since I don't recommend this technique I'm not going to go into details here, but it is simple. Have the user save their scripts as applications and then command the Finder to launch the selected application "script". However, most AppleScript writers don't like to save their scripts as applications; they like to save them as compiled scripts. So we need a technique to have a REALbasic program run a compiled script. To do this we'll use a script embedded into our project that runs external scripts. Type this script into "Script Editor" and save it as a compiled script called "RunScript".

...End of Excerpt. Please purchase the magazine to read the full article.