Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Ask The Experts

Article

Issue: 1.6 (June/July 2003)
Author: Seth Willits
Article Description: No description available.
Article Length (in bytes): 8,153
Starting Page Number: 32
RBD Number: 1616
Resource File(s):

Download Icon 1616.sit Updated: Friday, October 17, 2003 at 12:21 PM

Related Web Link(s):

tom-at-thezaz.net
http://www.tildesoft.com/

Known Limitations: None

Excerpt of article text...

I didn't have any trouble

Q: How can I execute a dynamic AppleScript directly from REALbasic?

This is a good question. Currently there are some issues with REALbasic 4.5 and AppleScripts under OS X (these issues have been resolved with later versions of OS X and RB, though). Thankfully, there are a few ways we can work around this. Other than doing the hokey-pokey wearing your clothes inside out, in OS X we can use a very simple shell call, and in Classic we can use a good chunk of code that utilizes declare statements to get the job done.

For OS X, the shell method is as simple as passing a few parameters to the command line utility osascript. To execute an AppleScript directly from a string variable, we use:

Sub RunAppleScript(script as string)

dim s as Shell

s = new shell

s.execute "/usr/bin/osascript -e '" + script + "'"//text of Applescript

msgBox s.result

// Notice the -e switch.

End Sub

To execute a script directly from a file, we use:

Sub RunAppleScript(UnixPathToScript as string)

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

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com