• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Running `expect` from inside AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Running `expect` from inside AppleScript


  • Subject: Running `expect` from inside AppleScript
  • From: Jenni via AppleScript-Users <email@hidden>
  • Date: Wed, 8 Dec 2021 10:11:33 -0800

        I'm trying to combine multiple scripts into a single AppleScript but
I'm running into problems.  Everything here works perfectly when called in an
external bash script, but not as written below.   I'm guessing it's a quoting
issue, though I just don't see it.  It's giving me errors like:

Error Number: 1
Terminal got an error: couldn't read file "
sleep 1
send ********     <-- my password
expect *root@server:*
interact
": no such file or directory

        How can I get this to work as a standalone AppleScript?  It would be
nice to have everything in one file, since it's so short.

Thanks,
Marc


set _username to "root"

if application "FileMaker Pro 18 Advanced" is not running then
        tell application "FileMaker Pro 18 Advanced" to activate
        delay 9
end if

try
        tell application "FileMaker Pro 18 Advanced"
                open "/Users/work/Filemaker/passwords.fmp12"
                show (every record of current table whose cell "username" =
_username)
                set _password to get data cell "password" of current record
        end tell
end try

tell application "Terminal"
        tell application "System Events" to keystroke "n" using {command down}
        do shell script "/usr/bin/expect -c \"
## Variables ##
set force_conservative 1
set timeout 9

## Login ##
spawn ssh email@hidden

expect \"password: \"

sleep 1

send \"" & _password & linefeed & "\"

expect \"*root@server:*\"

interact
\""
end tell




 _______________________________________________
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

  • Follow-Ups:
    • Re: Running `expect` from inside AppleScript
      • From: Christopher Stone via AppleScript-Users <email@hidden>
  • Prev by Date: Re: My AppleScript to choose sound output has broken in Monterey
  • Next by Date: Re: Running `expect` from inside AppleScript
  • Previous by thread: Re: My AppleScript to choose sound output has broken in Monterey
  • Next by thread: Re: Running `expect` from inside AppleScript
  • Index(es):
    • Date
    • Thread