Re: How can we execute remote AppleScript?
Re: How can we execute remote AppleScript?
- Subject: Re: How can we execute remote AppleScript?
- From: Christopher Nebel <email@hidden>
- Date: Tue, 10 Nov 2009 09:47:47 -0800
If B already has the script handler ready to go, and just needs the parameters, then it's trivial: use a handler call with parameters:
tell remote_app to frotz("hello", "world")
Remember, applets can define handlers, which can then be invoked from another script (either on the same machine or a different one), much like telling a regular application to do some command. The calling syntax is exactly the same as calling a handler defined in your own script, aside from the additional "tell" bit to specify who's supposed to execute it.
If B *doesn't* have the script -- it's being supplied in some form by A -- then it's harder, but still possible. For instance, if the script is plain-text source, then you could muck around with textual substitution to build a new source string that has the actual parameter values.
--Chris Nebel
AppleScript Engineering
On Nov 9, 2009, at 3:52 PM, Jim Skibbie wrote:
> Is there a way to execute a script remotely where you can also pass arguments to the remote script?
>
> Machine A: needs to run script on Machine B, but the script needs a few arguments to run.
>
> Machine B: has the local script to run, needs the remote ‘tell’ but also needs the arguments passed to it.
>
> Thanks.
> Jim
>
>> On Apr 3, 2007, at 5:04 PM, Jon Pugh wrote:
>>
>> At 3:43 PM -0500 4/3/07, Wallace, William wrote:
>>
>> Does anybody else have any insights on this, because I'd like to know the
>> answer too (this could be very useful to me if I can get it to work
>> reliably). I get a "user authentication failure" error. I am using a valid
>> username/password combo, and have verified that remote apple events are
>> enabled.
>>
>> I don't know that this is the problem, but it may simply be that you are not allowed to run osaxen (like beep and run script) remotely. There used to be an osiz resource which specified if an osax was allowed to run remotely. I'm not sure if there's any corresponding technique to allow or prevent remote osaxen these days.
>>
>> Indeed, "run script" does not allow remote execution -- it's a security thing. In general, scripting addition commands that trigger user interface are not allowed to run, though you can still annoy the heck out of the remote user with "beep" and "say". [1]
>>
>> Alternatively, if the target application is an AppleScript applet, declare a handler: you can then "tell" the application remotely to execute that handler. You could even deliberately circumvent the security by declaring a handler like this:
>>
>> on my_run_script(s)
>> run script s
>> end
>>
>> To answer William's question, the remote/local check is done in code these days; there's no simple way to turn it off.
>>
>>
>> --Chris Nebel
>> AppleScript Engineering
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden