In the past I’ve written a few ‘normal’ apple scripts that call each other’s subroutines… So having just finished my first studio app I was some what taken back when, in-spite of it’s huge dictionary, the following failed:
tell application "MyStudioApp" to mySub()
--> MyStudioApp got an error: can't continue mySub.
I hope I’m doing something wrong?!? Is this even possible in AppleScript Studio?
No, it doesn’t work like this. AppleScript Studio apps are Cocoa applications that happen to use AppleScript through an internal script. If you want to access an AS Studio’s AS routines, you have to target that app’s script:
Jon
[This script was automatically tagged for color coded syntax by Script to Markup Code]
That’s close but it’s not quite what I need - here’s what I’m trying to do…
I want to send a remote event to my studio app, from a client script, with a few strings that it does a few things with and then puts them in a table on the main window…
So the ‘client’ code would look something this →
tell application "blah://<remote path>/MyStudioApp"
mySub("string 1", "string 2")
end tell
Now the work around I’ve come up with is to add another standard script into the mix, on ‘the server’, which takes the remote events and tells the table in the studio app to add the data… Does that make any sense? Is there a better way perhaps?
Thanks again,
Tom
Ps. I went to a Linux Expo today… and I’ve never seen so many iBooks in one place before
It sounds like you need three scripts: 1 on the client machine and then 2 on the remote machine–one being the AS Studio app and another being a FBA that accepts the call from the client, parses the strings, and then tells the AS Studio app to update its interface accordingly. That shouldn’t be too bad.
Yeah… I thought as much… the only other way I can think of is to use a ‘real’ Cocoa app to control the interface and script that remotely using the ‘call method’ event… but that means I’d have to rewrite all the code in Java (after 2 years of working with Java Objective C makes no sense to me) which is too much of a pain to think about!
Not to pick your nits, Tom, and realizing that you may have used the term ‘real’ loosely, I am under the impression that AppleScript Studio apps ARE real Cocoa apps, even though they may make use of non-Cocoa entities. Is this untrue?
– Rob (a real AppleScripter who doesn’t use Studio)
You are quite right… studio apps are real cocoa apps - hence my use of sarcastic quote marks…
As I type, I feel a can of worms opening, so I will be breif… but using AppleScript to write fully fledged applications always feels like a bit of a cheat to me - but that’s a good thing!
Please feel free to pick my nits - I’d hate for someone to get the wrong idea!