Page 2 of 2

Recipe for Script Editor to Revolution app communication

Posted: Sun Mar 23, 2008 2:41 am
by keenethery
This is what worked for me. I am running Leopard (10.5.2) on a Power PC, and using Revolution 2.8.1.

1. Open Revolution
2. File / New Mainstack
3. Object / Stack Script
4. enter the following script

on barklikeadog additionalStuff
return "arf arf" && the seconds && additionalStuff
end barklikeadog

5. Apply, close the stack script
6. Object / Stack Inspector
Name: AppleEventCatcher
7. close the inspector
8. File / Save
9. File / Standalone Application Settings
10. Windows
Build for: (de-select the checkbox)
11. close the Standalone Application Settings window
12. File / Save
13. File / Save As Standalone Application
14. Quit Revolution
15. in the Finder, go to the newly created Mac application "AppleEventCatcher" and with the control key down, click on the application. Select "Show Package Contents"
16. Go to Contents / Resources / Revolution.rsrc and change the name of that file to AppleEventCatcher.rsrc
17. close the Show Package Contents window
18. Open Apple's Script Editor.
19. In the script window enter the following script:

property thescript : []

on run
copy "barklikeadog beg" to thescript
tell application "asdfgh"
activate
do script thescript
end tell
end run

20. Don't press the Compile button.
21. File / Save and it will ask you where asdfgh is located. Select the newly modified Mac application "AppleEventCatcher"
22. Press the Run button
23. The Result window should display something like:
"arf arf 1206236082 beg"

From what I can see, the communication style I am using does not permit more that one word to be sent from the Script Editor to the application. My way around that is to URLencode what I wish to send and then URLdecode in the application. I don't know what kinds of payload limits there are going to and coming from the application.

Re: calling a RR script form Applescript

Posted: Sun Sep 15, 2013 12:40 pm
by rrBUSS9EE
OK, so now that LiveCode produces no .rsrc file, how do I get this working?

Re: calling a RR script form Applescript

Posted: Sun Sep 15, 2013 12:55 pm
by Klaus
rrBUSS9EE wrote:OK, so now that LiveCode produces no .rsrc file, how do I get this working?
What exactly has this to do with this 5 year old thread? 8)

Sorry, no idea what you are after... :D

Re: calling a RR script form Applescript

Posted: Sun Sep 15, 2013 1:04 pm
by Mark
Hi,

Manually copy the file /Applications/LiveCode Community 6.x.x.app/Contents/Resources/LiveCode.rsrc to your standalone and continue from there.

Kind regards,

Mark

Re: calling a RR script form Applescript

Posted: Sun Sep 15, 2013 1:17 pm
by Klaus
AHA! :D


Your message contains 7 characters. The minimum number of characters you need to enter is 10.

Re: calling a RR script form Applescript

Posted: Sun Sep 15, 2013 3:44 pm
by rrBUSS9EE
Mark wrote:Manually copy the file /Applications/LiveCode Community 6.x.x.app/Contents/Resources/LiveCode.rsrc to your standalone and continue from there.
Thanks Mark...

But something is still quite wrong. I can now compile an AppleScript, but evaluate <expression> is failing when I call it in a Standalone, however not when I call it in LiveCode. I get "Error parsing expression".

Again... works perfectly in a stack under LiveCode, same stack as a standalone... nada. Very frustrating!

My expression looks like this:

executeTach("Command Unit 1")

This function in the stack looks up "command Unit 1" in an sqLite DB, opens a socket, starts a timer, and writes a string to the socket. When the timer message comes in it closes the socket. Thats it!