Using The Apache-Apple Event Bridge to Return a Script Object

After releasing 1.4, someone asked about returning a Script Object with AAEB.  Here’s a quick sample using AAEB 1.5 to call the script from Apache:

Place a simple script on your server that returns a script object (incorporate something like this into one of the sample AppleScripts included with AAEB):

script scriptObj
property p : “hello”
on dd()
display dialog p
end dd
end script
return scriptObj

Place this on your “Script Server”, save and compile the AppleScript for use with AAEB.

Next, on your “Client” machine, run the following script, which will go across the net, get the script object from the above compiled script and use it locally. (Note that curl is used to save the binary data to a file — any mechanism that calls or loads a URL would work.)

do shell script “curl -o curl.out http://192.168.1.2/cgi-bin/connectnr.aaeb?appName=scriptObject.app”
set my_lib to load script file “Macintosh HD:curl.out”
my_lib’s dd()

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s