Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Securely run remote AppleScripts System
normally with ssh you can run (on the command line) 'ssh machine command' to run a command on a remote machine. so put a compiled applescript called 'testscript' in your home directory and try and run it from a remote (or even the local) machine:
ssh yourmac testscript
and it will run that applescript. however, while that applescript shows up in the dock, it seems to have no access to running processes.

the trick is on the remote machine to run:
ssh yourmac 'open testscript'
the command above will instruct the running finder process to launch the applescript. see also the macosxhint Run an AppleScript from the command line and running applescripts via ssh? at macfixitforums.

for an example of a useful remote applescript (launch eudora and get new mail only when new mail exists), read the rest of the article.

Remote Eudora mail checking AppleScript:
tell application "Finder" to get creator type of every process
if result contains "CSOm" or result contains «class CSOm» then
tell application "Eudora 5.1 (OS X)"
connect with checking without sending and waiting
end tell
end if
i use the above applescript along with this in my .qmail file on my linux box to tell eudora to check mail only when i actually get new mail:
./Mailbox
|ssh mymac 'open /Users/rajiv/CheckMail.app'
now, anyone know how to pass information to and receive from the applescript? no matter how the applescript exits (you can even put in a 'return' or and 'exit' statement in the script), the ssh command will always return 0 if the script was able to run.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[9,308 views]  

Securely run remote AppleScripts | 1 comments | Create New Account
Click here to return to the 'Securely run remote AppleScripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Securely run remote AppleScripts
Authored by: simpgeek on Nov 07, '03 03:39:35PM

I don't really know too much about the subject at the moment, but you could write your applescript to check a specific file for options and such and send the output to a file. That way you can edit the input file remotely before you run the script and check the output file after the script completes. (you could even do something cool with mail like have it e-mail the results to you, check the example Mail scripts to see how.)



[ # ]