Re: GUI on top of Expect Script



Dukie91191 wrote:
Hi all,
Just to preface this, I am pretty new to Tcl/tk/Expect, but I seem to
be doing OK so far.

My problem is this, I have created an Expect script that logs into a
switch and configures it. It prompts the user for 3 pieces of
information and then it goes off on its merry way, works wonderfully.
Now, in a moment of daring, I started looking at Tcl/Tk to wrap this
script of mine up in a more user friendly GUI, as the script currently
runs from a command line.

expect is an extension to tcl
tk is an extension to tcl

You can use both at the same time and from the same script.

[exec]ing your expect script will make the gui inresponsive
while it is running.

label .lh -text Host:
entry .eh -textvariable ::IP
set ::IP ""
label .lu -text User:
entry .eu -textvariable ::USR
set ::USR ""
label .lp -text Pass:
entry .ep -textvariable ::PASSWD
set ::PASSWD ""

button .b -text Connect -command {ssh_connect $::IP $::USR}
label .ls -textvariable ::STATUS
pack -side left .lh .eh .lu .eu .lp .ep .b .ls
set ::STAT -/-

proc ssh_connect {ip usr} {
if {$ip == "" } {
set ::STAT NO_IP
return
}
if {$usr == "" } {
set ::STAT NO_USR
return
}
set ::status trying:$ip
spawn ssh ${usr}@$host
set :curr_spid $spawn_id
expect "assword: " {
set ::STAT "sending password"
exp_send "$::PASSWD\r"
...
}


vwait forever
#end
.



Relevant Pages

  • Re: WORD doc info into FMP?
    ... it appears that each line of the entry follows the format ... number of any given type of field (Location, script, sets etc.) you might ... into a separate record in a database, and a separate related "database 2" ... Ten Nights in a Barroom (New York State Archives) ...
    (comp.databases.filemaker)
  • RE: Need some MySQL query help...
    ... attempting to run the script: ... passed to the database. ... passwd entry to the current database entry. ...
    (perl.dbi.users)
  • Re: How to make Apache (2.2.4) less greedy, or Sendmail less polite? [semi-solved]
    ... Then I make an entry in my /etc/hosts.allow file that denies access to all in my hosts.deny file. ... Firstly, I took some measures to figure out where the issues came from, and using Apache's "server-status" handler, I noticed the script that caused Apache to choke up, was a PHP script that shows entries of photographic events that I organise from time to time. ... I then wondered why, as this script never caused trouble before, and while checking the server status I did already notice that the "store comments" script was called very often. ... the machines that were used for this, and I will report them to the proper anti spam authorities, such that they will be blacklisted Internet wide. ...
    (freebsd-questions)
  • Re: Windows Explorer size reverting to 800x600
    ... I've pre-empted your reply and looking at your script I realise that the ... A similar entry exists in ... All of the folders are on a local drive. ... Const conBagMRUSize = _ ...
    (microsoft.public.windowsxp.general)
  • Re: contest software
    ... > submit an entry to a project, ... The project holder must then select a winning design. ... As ever, this list isn't a script writing service, and it certainly ... * make a web site explaining the contest ...
    (perl.beginners)