Passing Values to RunRev from an AppleScript

Jim Ault JimAultWins at yahoo.com
Fri Dec 1 22:53:17 EST 2006


Agreed, Mark
your email encouraged me to revisit an old issue

On 12/1/06 11:31 AM, "Mark Schonewille" <m.schonewille at economy-x-talk.com>
wrote:
> Dave, Ken,
> Apologies. Here is the correct solution, all AppleScript:
> 
> tell application "Revolution"
>    do script "put \"Some Value\""
> end tell
> 
> You could run a script to send a message to a progress bar, for example.
-------
> it is not necessary to split up a script, because you can send
> transcript commands from within AppleScript to Revolution, as I
> showed in an earlier mail
---------
------ (working scripts appear below )-----------------------

I have not tried this in a long time since 'do script' sent to Rev used to
work in 2.2.1, 
then got broken for 2.5 and 2.6.
I used other ways to workaround DO SCRIPT not functioning.

Just tried it in 2.7.2 and got it to work.
Bugzilla shows that DO SCRIPT was FIXED , very good news  :-)
[however an old bug still remains >>>
After editing a script and clicking Apply, you need to go to the tool bar
and change the mode (browse>pointer>browse) to get the appleEvent handler to
listen properly.  Very odd, but I found this 2 years ago in 2.2.1

Now make a change in the [ on appleEvent ] script container, apply, and it
no longer works.  Even if all you add to the script container is one space,
then apply, it does not listen (silent failure,  no error).  This does not
happen 100% of the time, but most always.

Another bug ? > get the scripts below running OK, then click in the lower
message box, select all, backspace to clear it, then click on your stack to
make it the frontmost, then run Script Editor => does not work (silence).

[1a] clear the msg box, stops working
[1b]Click pointer mode, browse mode, and it works again
[2] clear the msg box, stops working
[2b] Cmd-S to save the stack (although you made no changes), and it works
again

In my production work I have avoided any dependence on Rev's DO SCRIPT.  Too
much money at risk. [PS - I am submitting to Bugzilla tonight ]

Jim Ault
Las Vegas
------ WORKING SCRIPTS BELOW------------------------
--  FOR BOTH SCRIPT EDITOR AND REV STACK SCRIPT

----Script Editor --simple script
tell application "Revolution"
    do script "testHandlerA"
    activate
end tell
------- Script Editor --repeat loop
--watch word wrap
try
    tell application "Finder" to set the source_folder to (folder of the
front window) as alias
on error -- no open folder windows
    set the source_folder to path to desktop folder as alias
end try
set the item_list to list folder source_folder without invisibles
set source_folder to source_folder as string
repeat with i from 1 to number of items in the item_list
    set this_item to item i of the item_list
    set this_item to (source_folder & this_item) as alias
    set this_info to info for this_item
    set the current_name to the name of this_info
    set dataToSend to the current_name
    tell application "Revolution" to do script (dataToSend)
end repeat
beep 2
source_folder & dataToSend

----Revolution 2.7.2   OSX 10.4.7
--New Mainstack,  stack script, no other stacks open
--[2] handlers

on appleEvent p1, p2, p3
  put cr& "APPLE EVENT RECEIVED  " after msg
  request AppleEvent data
  put cr & p1&& p2 && p3 && it after msg
  
  if p1&p2 is "miscdosc" then
    request AppleEvent data
    put it into tData
    try
      --do tData
      send tData to me in 500 milliseconds
    catch errorMsg
      answer error "Unable to execute handler '"&tData&"'..."
      exit appleEvent
    end try
    exit appleEvent
  end if
  
  pass appleEvent
end appleEvent


on testHandlerA
  put cr& "You got here via AS  !!!    another fine functionality" after msg
end testHandlerA





More information about the use-livecode mailing list