Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  AppleScript Primer for Mac OS X
Subject:   CLI & Applescript
Date:   2002-02-12 09:23:38
From:   naepstn
How extensively can you integrate CLI commands and Applescript?


Specifically, can I write an Applescript similar to your example you gave for printing, but after copying over a .ps file, would SSH to the Linux machine that the file was sent to (and which is acting as an LPR print server for the Windows print server), and then issue the following shell command over SSH:
lpr -P HP3200 myfile.ps


Ideally, if it could access the keychain to decrypt the SSH login password, that would be great, but it could also prompt me to enter the password each time, but it would have to display the keystrokes as asterisks or some other masking character.


Is this possible within the confines of Applescript, or would this require writing new methods or other such programming for which I lack the skills?


Cheers!
Noah


P.S. Is this going to be a recurring column? It would sure be nice if it was. :-)

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • CLI & Applescript
    2002-05-20 18:28:26  mpf [View]

    I have written a document outlining how you can use ssh from within applescripts and store the passphrases in our keychain. You can find it at http://www.progsoc.org/~mpf/macosxsshlogin.html .

    regards

    matthew
  • CLI & Applescript
    2002-02-12 17:44:55  bwperry [View]

    You can do a lot with AppleScript (AS) and "do shell script", which uses /bin/sh as the shell (as far as I know). Take the commands that you want to integrate into an AS and test them first with a "do shell script" command used in a simple script; experiment a bit. This is a new technology. I've found that certain types of shell commands passed to "do shell script" as arguments, such as the "history" command, will return errors.

    As I suggested in my article, this has a lot of potential for combining advanced desktop automation with the wealth of Unix shell commands (particularly when given a user interface in Studio). I'd imagine that Apple would continue to refine and enhance what the scripter can accomplish with "do shell script."

    I'd like this to become a recurring column. Email the O'Reily editors and make a request :)