calling a RR script form Applescript

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

keenethery
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2
Joined: Mon Aug 27, 2007 9:33 pm
Contact:

Recipe for Script Editor to Revolution app communication

Post by keenethery » Sun Mar 23, 2008 2:41 am

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.

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: calling a RR script form Applescript

Post by rrBUSS9EE » Sun Sep 15, 2013 12:40 pm

OK, so now that LiveCode produces no .rsrc file, how do I get this working?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: calling a RR script form Applescript

Post by Klaus » Sun Sep 15, 2013 12:55 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: calling a RR script form Applescript

Post by Mark » Sun Sep 15, 2013 1:04 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: calling a RR script form Applescript

Post by Klaus » Sun Sep 15, 2013 1:17 pm

AHA! :D


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

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: calling a RR script form Applescript

Post by rrBUSS9EE » Sun Sep 15, 2013 3:44 pm

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!

Post Reply