calling a RR script form Applescript
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
calling a RR script form Applescript
Opening the RunRev dictionary from Applescript editor, I found RunRev support the "do" and "Evaluate" command, to call an handler and to get a function result from Applescript.
I made a few tests but, while I was able to call commands like "open" or "quit", I wasn't able to call specific handlers in a stack.
Has someone an idea of how to do that?
Thanks.
P.S. I'm searching a way to make Director and Revolution talk. Other ideas different from Applescript?
I made a few tests but, while I was able to call commands like "open" or "quit", I wasn't able to call specific handlers in a stack.
Has someone an idea of how to do that?
Thanks.
P.S. I'm searching a way to make Director and Revolution talk. Other ideas different from Applescript?
Wonder if you try using apple events. Revolution supports apple events
Apple scripts .sdef files show that most all scripts have an aevt code.
I would assume that you could set a revolution standalone to be scriptable by use of apple event codes and build a sdef file for use with apple script. I only have tried it with cocoa but I can't see why it wouldn't work with revolution with a little tinkering around.
Your question interest me to try it.
Apple scripts .sdef files show that most all scripts have an aevt code.
I would assume that you could set a revolution standalone to be scriptable by use of apple event codes and build a sdef file for use with apple script. I only have tried it with cocoa but I can't see why it wouldn't work with revolution with a little tinkering around.

Revolution support two Applescript command: Do script and Evaluate.
Do script executes any RR script, Evaluates returns a RR function value.
works without problems.
But
or also
doesn't do anything.
So I guess what is the right way to use "do script"[/code]
Do script executes any RR script, Evaluates returns a RR function value.
Code: Select all
Tell "Revolution"
do "quit"
end tell
But
Code: Select all
Tell "Revolution"
do script "myScript" of stack "test"
end tell
Code: Select all
Tell "Revolution"
do script "\"myScript\" of stack \"test\""
end tell
So I guess what is the right way to use "do script"[/code]
-
- Livecode Opensource Backer
Hi mmiele,
it may be that you have to use proper runrev do syntax. Check out the docs:
it may be that you have to use proper runrev do syntax. Check out the docs:
Code: Select all
do "go next card"
do "put" && x && "into myVar" & x -- might become "put 3 into myVar3"
do "select" && line 3 of field "Objects"
do "send myhandler to stack myStack"
Re: calling a RR script form Applescript
Hi mmiele ~mmiele wrote: I'm searching a way to make Director and Revolution talk. Other ideas different from Applescript?
Can you give a simple example of what you want Director to communicate to a Rev stack? I'm not familiar with Director's Lingo syntax. Is this a two way communication? Do you need to send feedback back to Director?
I'm far from an expert on Rev like some on this forum and I may be way off here on what exactly you want to do but...
It could be you need to put what you want to send from Director into a text file, then read the text file into a variable in your Rev stack, then translate that into a workable Rev script.
Lynn P.
Dear friends,
the "do" is a RR command: you can only use it from the inside of RR, eventually to control another application using Applescript.
What I need is just the opposite: to control RR trough Applescript from the outside of RR.
Every application which is "Applescript ready" responds to common commands ("new","open", "quit", etc.) and commands which are specific of the application.
The only specific commands to control RR trough Applescript, are "do script", to execute a RR handler, and "evaluate", to get the result from a RR function (these are the only shown if you open the RR dictionary from the inside of the Applescript editor).
As you can imagine, these are enough to do almost everything.
But the Applescript dictionary doesn't give the syntax of these two commands and I wasn't able to find it anywhere.
the "do" is a RR command: you can only use it from the inside of RR, eventually to control another application using Applescript.
What I need is just the opposite: to control RR trough Applescript from the outside of RR.
Every application which is "Applescript ready" responds to common commands ("new","open", "quit", etc.) and commands which are specific of the application.
The only specific commands to control RR trough Applescript, are "do script", to execute a RR handler, and "evaluate", to get the result from a RR function (these are the only shown if you open the RR dictionary from the inside of the Applescript editor).
As you can imagine, these are enough to do almost everything.
But the Applescript dictionary doesn't give the syntax of these two commands and I wasn't able to find it anywhere.
Okee Dokee! I only used the do script, not evaluate yet, but this is the syntax I used:
I put this in my stack's stack script:
and put this in AppleScript:
Is this what you were looking for? 
Lynn P.
I put this in my stack's stack script:
Code: Select all
on myScript
answer "I hear you AppleScript!" with "OK"
end myScript
Code: Select all
tell application "Revolution"
activate
do script ("myScript")
end tell

Lynn P.
Dear Lynn,
doesn't work on my system, but I've found a way:
But now I have another problem: if I close the stack in a standalone named "myApp",
doesn't compile as a script.
The Applescript editor doesn't see "myApp" as a scriptable application.
Maybe I should include something when I save the stack as a standalone?
Code: Select all
do script ("myScript")
Code: Select all
tell application "Revolution"
activate
do script "send \"myScript\" to stack \"myStack\""
end tell
Code: Select all
tell application "myApp"
activate
do script "send \"myScript\" to stack \"myStack\""
end tell
The Applescript editor doesn't see "myApp" as a scriptable application.
Maybe I should include something when I save the stack as a standalone?
``````````````````mmiele wrote: But now I have another problem: if I close the stack in a standalone named "myApp",
doesn't compile as a script.Code: Select all
tell application "myApp" activate do script "send "myScript" to stack "myStack"" end tell
The Applescript editor doesn't see "myApp" as a scriptable application.
Maybe I should include something when I save the stack as a standalone?
Go into your apps bundle by holding down the Control key while clicking on your app.
Choose Show Package Contents from the resulting menu.
Navigate to the folder Contents->Resources
Change the name of the file "Revolution.rsrc" to your apps name such as "MyApp.rsrc".
It should work after that.

Lynn P.
-
- VIP Livecode Opensource Backer
- Posts: 2
- Joined: Mon Aug 27, 2007 9:33 pm
- Contact:
Can you add this info to the documentation?
I've been searching off and on for this answer for over 2 years. It would be really handy if the docs showed:
1. the applescript that you would put into ScriptEditor to send and receive info via AppleEvents from a RunRev app.
2. a stack script catches the appleevent, reads data from a text field and replies to the appleevent with that info.
3. Plus, highlight that the .rsrc file name has to be changed for the app to accept AppleEvents.
The existing 2.8.1 docs only show a small part of the solution. Enough to make you think it works but not enough to get it to work. Documentation plus a sample stack / app and ScriptEditor script would be very helpful.
Thanks, Kee Nethery
1. the applescript that you would put into ScriptEditor to send and receive info via AppleEvents from a RunRev app.
2. a stack script catches the appleevent, reads data from a text field and replies to the appleevent with that info.
3. Plus, highlight that the .rsrc file name has to be changed for the app to accept AppleEvents.
The existing 2.8.1 docs only show a small part of the solution. Enough to make you think it works but not enough to get it to work. Documentation plus a sample stack / app and ScriptEditor script would be very helpful.
Thanks, Kee Nethery
Re: Can you add this info to the documentation?
It has been mentioned on the use list, for example here:keenethery wrote:I've been searching off and on for this answer for over 2 years.
http://article.gmane.org/gmane.comp.ide ... pplescript
Nonetheless, I agree that the docs should include this kind of information.
Best,
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode