Send appleevent to livecode doesnt work ?

J. Landman Gay jacque at hyperactivesw.com
Sat Dec 8 15:43:18 EST 2012


On 12/8/12 2:40 PM, J. Landman Gay wrote:
> On 12/8/12 1:31 AM, Serge Brami wrote:
>> I want to send an Applevent  to another livecode app running  on an
>> other Mac on a local network.
>>
>> for example
>>
>> on the Mac 1  a button  with the script :
>> "on mouseup
>>      send "hello" to "Mac2:livecode"
>> end mouseup"
>>
>>
>>
>> on the Mac 2
>>
>> "on appleevent type
>>      if type is "aevt" then
>>        put "hello"
>>      end if
>> pass applevent
>> end applevent
>>
>>
>> Well it works BUT only il on mac2 I switch from livecode to another
>> app and then switch back to livecode
>
> I haven't used appleEvents for years, but the way I'd debug this would
> be to change the receiving handler to show the parameters and see what
> you get:
>
> on appleevent
>   repeat with x = 1 to the paramcount
>     put x && "=" && param(x)
>   end repeat
> end appleevent
>
> That may show you what is being sent and give you an idea of what's
> wrong. The type may not always be "aevt".
>

Actually, my suggested handler will go by too fast to see. Better change 
it to accumulate the info like this:

on appleevent
  repeat with x = 1 to the paramcount
    put x && "=" && param(x) & cr after tList
  end repeat
  put tList -- or you can use "answer tList"
end appleevent


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list