Re: Running Processes on Remote machine.
Re: Running Processes on Remote machine.
- Subject: Re: Running Processes on Remote machine.
- From: peter boardman <email@hidden>
- Date: Fri, 25 Feb 2005 10:01:37 +0000
Kumar Shailove <email@hidden> said on 2005-02-25, 10:44 (+0530 GMT):
> set remoteMachine to "eppc://email@hidden"
> tell application "System Events" of machine remoteMachine
> set myList to name of every application process
> end tell
>
> It doesn't work and doesn't give me the list of processes.
> Any ideas whats the problem and how to resolve this??
My understanding of this is that AppleScript needs to access an application’s dictionary when it compiles a script, but in this example it can’t, since the location of the application you’ve specified isn’t known at that moment - you’re using a variable to specify the application’s location on your remote machine, and the variable isn’t really ‘working’ at compile time. (Compile time is when you click Compile or press Enter in Script Editor, when your typing gets formatted and coloured. It’s also done (if necessary) when you Run the script, usually so quickly you don’t notice.)
In your first example, you provided a route to an application’s dictionary that it could easily find at compile time, since it was on your easy-to-find local machine. But if you’re specifying the machine at runtime you have to provide AppleScript with a suitable dictionary substitute at compile time (even though a different dictionary will be used at run time). This is done with a ‘terms’ block:
--
set remoteMachine to "eppc:// whatever"
using terms from application "System Events"
tell application "System Events" of machine remoteMachine
set myList to name of every application process
end tell
end using terms from
--
When AppleScript compiles this, it uses the System Events on your local machine. When it runs this, it uses the System Events on the target machine.
I think that’s how it goes, anyway.
Pete
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden