AppleEvents and RunRev

Kee Nethery kee at kagi.com
Wed Feb 3 14:59:52 CST 2010


On Feb 3, 2010, at 12:15 PM, Emmett Gray wrote:

> How do you tell Rev to do something useful via applescript?
> 
> I tried
> 
> tell application "Revolution Media"
> activate
>   --would like ideally first to: do script "go stack " & quote & "Foo" & quote & " in a new window"
>   --but I couldn't even get the next command to work if the stack was already open and frontmost
>   do script "create card"
> end tell
> 
> Nothing happens other than activation. While I'm asking, the next things I would want to have happen are to put the clipboard into a field and send a mouseUp to a button.

This is what worked for me. I was running Leopard (10.5.2) on a Power PC, and using Revolution 2.8.1 when I wrote these instructions. Assume they still work today.

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.

Kee Nethery




More information about the use-livecode mailing list