Support
All support resources for our products. Here you can find answers to frequently asked questions, discuss with other users, recover a lost license code or file a support request.
Forum closed
This forum was closed and turned into an archive effective April 21, 2018. It is no longer possible to create new topics or reply to existing topics.

Thanks everyone for all the great questions and contributions over the years.

Please use the Contact form to get in touch.

Remote Buddy Forum

Overview 

AuthorThread
User

11.05.2007 19:57:01
Re: Re: arrays

This posting is older than 6 months and can contain outdated information.
Hello Silas,

the problem is that you may not use "with return value" from within a 
Remote Buddy action, as what will happen is this:

1) Actor executes AppleScript inside Remote Budy (fine) 
2) AppleScript calls a Remote Buddy command (fine) 
3) Now where it breaks: Remote Buddy executes the command. During 
execution, it checks whether the "return value" is true. If it is, 
Remote Buddy will tell Cocoa to suspend the execution of the script 
and that it will send the return value later. It's just that the 
script that is sent to sleep is executed by Remote Buddy itself. In 
the main thread (thanks to AppleScript not being thread-safe - not 
even to the point as that it could safely be executed on a seperate 
thread). AppleScript locks up.

The solution is to return immediately and call into the same 
AppleScript again lateron, but this time in a handler. That's what

on menureturn(hiddenID, menuname) 
... 
end menureturn

is for. That's also why two examples are provided in the AppleScript 
dictionary - once for usage inside - and then from outside of Remote 
Buddy. If you use the handler-method, you can execute your entire 
script inside an actor just fine. Using the menuname as identifier 
will further easify the handling of the result value.

The last open question was whether you can - from within that handler 
- call showmenu again and whether Remote Buddy would still know which 
AppleScript actor it should return into. I did not think of this 
during the design phase. So I just did a quick code audit - and it 
looks good. It should work just fine.

Hope that helps ;-)

Best regards, 
Felix 

Thread-display::