#!/usr/local/bin/expectk # # EDIT THE ABOVE LINE TO POINT TO WHERE expectk LIVES # # ALSO !!!! # # CHANGE set expect_path [exec which expect] # to set expect_path /man/my/expect/path/is/stupid/expect # if which won't pull up the correct version of expect # # Version Beta1.05 set expect_path [exec which expect] ######################################################################## # JUST MY NOTES -- nothing below here to edit ######################################################################## # UPDATING # # Change colors for all new buttons boxes, etc. # Change Version in the About Box # # FOR FUTURE RELEASES # # Lock for a user like netscape?? (who cares??) # # EDIT , change name creates new entry (who cares??) # # Titles for all toplevel winders # ######## global name hostname_array login_array passwd_array sshopts_array sshopts custom custom_array global term termopts termexe ## No accidently undefineds set custom "" set sshopts "" set sshbuddyhome $env(HOME)/.sshbuddy file mkdir $sshbuddyhome set data_file $sshbuddyhome/sshdata set color_file $sshbuddyhome/sshcolors set geo_file $sshbuddyhome/sshgeo set term_file $sshbuddyhome/sshterm set vers_file $sshbuddyhome/version proc restore_term_defaults {} { global term termopts termexe set term "xterm" set termopts "+ls -bg black -fg green" set termexe "-e" } if [file exists $term_file] then { set fileId [open $term_file r 0600] gets $fileId line set term $line gets $fileId line set termopts $line gets $fileId line set termexe $line close $fileId } else { restore_term_defaults } ; # END IF if [file exists $color_file] then { set fileId [open $color_file r 0600] gets $fileId line set main_window_color $line gets $fileId line set button_color $line gets $fileId line set button_text $line close $fileId } else { set main_window_color darkblue set button_color darkorange set button_text white } ; # END IF proc save_changes {} { global color_file main_window_color button_color button_text term_file term termopts termexe set fileId [open $color_file w 0600] puts $fileId "$main_window_color" puts $fileId "$button_color" puts $fileId "$button_text" close $fileId set fileId [open $term_file w 0600] puts $fileId "$term" puts $fileId "$termopts" puts $fileId "$termexe" close $fileId } ; # END save_changes proc apply_changes {} { global main_window_color button_color button_text . config -bg $main_window_color .butedit config -bg $button_color -fg $button_text .butnew config -bg $button_color -fg $button_text .butdelete config -bg $button_color -fg $button_text .butedit config -bg $button_color -fg $button_text .but24 config -bg $button_color -fg $button_text .labsshbuddy config -bg $button_color -fg $button_text .listfr.list config -bg $button_color -fg $button_text if [winfo exists .abox] { .abox config -bg $main_window_color .abox.lababout config -bg $button_color -fg $button_text .abox.labatext config -bg $main_window_color -fg $button_text .abox.butclose config -bg $button_color -fg $button_text } if [winfo exists .advanced] { .advanced config -bg $main_window_color .advanced.labsshhead config -bg $button_color -fg $button_text .advanced.labssh config -bg $button_color -fg $button_text .advanced.entsshopts config -bg $button_color -fg $button_text .advanced.labcust config -bg $button_color -fg $button_text .advanced.labcustom config -bg $button_color -fg $button_text .advanced.entcustom config -bg $button_color -fg $button_text .advanced.butcancel config -bg $button_color -fg $button_text .advanced.butsave config -bg $button_color -fg $button_text } if [winfo exists .buddy_manual] { .buddy_manual config -bg $main_window_color .buddy_manual.labmanual config -bg $button_color -fg $button_text .buddy_manual.butconnect config -bg $button_color -fg $button_text .buddy_manual.butnew config -bg $button_color -fg $button_text .buddy_manual.butedit config -bg $button_color -fg $button_text .buddy_manual.butdelete config -bg $button_color -fg $button_text .buddy_manual.butadvanced config -bg $button_color -fg $button_text .buddy_manual.butclose config -bg $button_color -fg $button_text } if [winfo exists .conbox] { .conbox config -bg $main_window_color .conbox.labcontact config -bg $button_color -fg $button_text .conbox.labcontext config -bg $main_window_color -fg $button_text .conbox.butclose config -bg $button_color -fg $button_text } if [winfo exists .confirm] { .confirm config -bg $main_window_color .confirm.butdelete config -bg $button_color -fg $button_text .confirm.butcancel config -bg $button_color -fg $button_text } if [winfo exists .connectsetup] { .connectsetup config -bg $main_window_color .connectsetup.entname config -bg $button_color -fg $button_text .connectsetup.labsetup config -bg $button_color -fg $button_text .connectsetup.labname config -bg $button_color -fg $button_text .connectsetup.labhostname config -bg $button_color -fg $button_text .connectsetup.enthostname config -bg $button_color -fg $button_text .connectsetup.labloginid config -bg $button_color -fg $button_text .connectsetup.labpasswd config -bg $button_color -fg $button_text .connectsetup.entlogin config -bg $button_color -fg $button_text .connectsetup.chesave config -bg $button_color -fg $button_text .connectsetup.entpasswd config -bg $button_color -fg $button_text .connectsetup.butadvanced config -bg $button_color -fg $button_text .connectsetup.butcancel config -bg $button_color -fg $button_text .connectsetup.butsave config -bg $button_color -fg $button_text .connectsetup.buthelp config -bg $button_color -fg $button_text } if [winfo exists .h2advanced] { .h2advanced config -bg $main_window_color .h2advanced.labadvanced config -bg $button_color -fg $button_text .h2advanced.labtext config -bg $main_window_color -fg $button_text .h2advanced.butclose config -bg $button_color -fg $button_text } if [winfo exists .h2connect] { .h2connect config -bg $main_window_color .h2connect.labconnect config -bg $button_color -fg $button_text .h2connect.labtext config -bg $main_window_color -fg $button_text .h2connect.butclose config -bg $button_color -fg $button_text } if [winfo exists .h2delete] { .h2delete config -bg $main_window_color .h2delete.labdelete config -bg $button_color -fg $button_text .h2delete.labtext config -bg $main_window_color -fg $button_text .h2delete.butclose config -bg $button_color -fg $button_text } if [winfo exists .h2edit] { .h2edit config -bg $main_window_color .h2edit.labedit config -bg $button_color -fg $button_text .h2edit.labtext config -bg $main_window_color -fg $button_text .h2edit.butclose config -bg $button_color -fg $button_text } if [winfo exists .h2new] { .h2new config -bg $main_window_color .h2new.labnew config -bg $button_color -fg $button_text .h2new.labtext config -bg $main_window_color -fg $button_text .h2new.butclose config -bg $button_color -fg $button_text } if [winfo exists .warning1] { .warning1 config -bg $main_window_color .warning1.butok config -bg $button_color -fg $button_text } if [winfo exists .warning2] { .warning2 config -bg $main_window_color .warning2.butok config -bg $button_color -fg $button_text } if [winfo exists .warning3] { .warning3 config -bg $main_window_color .warning3.butok config -bg $button_color -fg $button_text } if [winfo exists .warning10] { .warning10 config -bg $main_window_color .warning10.butok config -bg $button_color -fg $button_text } } ; # END apply_changes proc restore_defaults {} { global main_window_color button_color button_text set main_window_color darkblue set button_color darkorange set button_text white } ; # END restore_defaults proc reread_files {} { global color_file main_window_color button_color button_text term_file term termopts termexe if [file exists $color_file] then { set fileId [open $color_file r 0600] gets $fileId line set main_window_color $line gets $fileId line set button_color $line gets $fileId line set button_text $line close $fileId } else { set main_window_color darkblue set button_color darkorange set button_text white } ; # END IF if [file exists $term_file] then { set fileId [open $term_file r 0600] gets $fileId line set term $line gets $fileId line set termopts $line gets $fileId line set termexe $line close $fileId } else { restore_term_defaults } ; # END IF } ; # END reread_files proc change_settings {} { global main_window_color button_color button_text term termopts termexe if [winfo exists .settings] then { wm title .settings Settings wm deiconify .settings } else { toplevel .settings wm title .settings Settings set newgeo 360x400 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .settings $newgeo wm maxsize .settings 1265 946 wm minsize .settings 1 1 ########################## # Terminal Options ########################## label .settings.labtermhead \ -borderwidth 1 -relief raised -text "Terminal Options" label .settings.labterm \ -borderwidth 1 -relief raised -text "Terminal Command" entry .settings.entterm \ -textvariable {term} label .settings.labtermopts \ -borderwidth 1 -relief raised -text "Terminal Options" entry .settings.enttermopts \ -textvariable {termopts} label .settings.labtermexe \ -borderwidth 1 -relief raised -text "Execute Option" entry .settings.enttermexe \ -textvariable {termexe} button .settings.buttermdef \ -padx 11 -pady 4 -text "Default Terminal & Opts" \ -command {restore_term_defaults} ########################## # Color Options ########################## label .settings.labcolors \ -borderwidth 1 -relief raised -text Colors button .settings.butmwc \ -padx 11 -pady 4 -text "Change Main Window Color" \ -command { if {"[set temp [tk_chooseColor -initialcolor $main_window_color -title "Main Window Color" ]]" != ""} then { set main_window_color $temp ; \ apply_changes} } button .settings.butbc \ -padx 11 -pady 4 -text "Change Button Color" \ -command { if {"[set temp [tk_chooseColor -initialcolor $button_color -title "Button Color" ]]" != ""} then { set button_color $temp; \ apply_changes} } button .settings.buttc \ -padx 11 -pady 4 -text "Change Text Color" \ -command { if {"[set temp [tk_chooseColor -initialcolor $button_text -title "Text Color" ]]" != ""} then { set button_text $temp ; \ apply_changes} } button .settings.butdef \ -padx 11 -pady 4 -text "Change to Default Colors" \ -command { restore_defaults ; apply_changes } button .settings.butcancel \ -padx 11 -pady 4 -text "Cancel Changes" \ -command { reread_files ; apply_changes ; wm withdraw .settings } button .settings.butsave \ -padx 11 -pady 4 -text "Save Changes" \ -command {save_changes ; wm withdraw .settings} ################### # SETTING GEOMETRY ################### ################### # TERMINAL OPTIONS ################### place .settings.labtermhead \ -x 10 -y 5 -width 340 -height 18 -anchor nw -bordermode ignore place .settings.labterm \ -x 20 -y 35 -width 150 -height 28 -anchor nw -bordermode ignore place .settings.entterm \ -x 190 -y 35 -width 150 -height 28 -anchor nw -bordermode ignore place .settings.labtermopts \ -x 20 -y 70 -width 150 -height 28 -anchor nw -bordermode ignore place .settings.enttermopts \ -x 190 -y 70 -width 150 -height 28 -anchor nw -bordermode ignore place .settings.labtermexe \ -x 20 -y 105 -width 150 -height 28 -anchor nw -bordermode ignore place .settings.enttermexe \ -x 190 -y 105 -width 150 -height 28 -anchor nw -bordermode ignore place .settings.buttermdef \ -x 52 -y 140 -width 256 -height 28 -anchor nw -bordermode ignore ################## # COLORS ################## place .settings.labcolors \ -x 10 -y 175 -width 340 -height 18 -anchor nw -bordermode ignore place .settings.butmwc \ -x 52 -y 210 -width 256 -height 28 -anchor nw -bordermode ignore place .settings.butbc \ -x 52 -y 245 -width 256 -height 28 -anchor nw -bordermode ignore place .settings.buttc \ -x 52 -y 280 -width 256 -height 28 -anchor nw -bordermode ignore place .settings.butdef \ -x 52 -y 315 -width 256 -height 28 -anchor nw -bordermode ignore place .settings.butcancel \ -x 10 -y 360 -width 125 -anchor nw -bordermode ignore place .settings.butsave \ -x 225 -y 360 -width 125 -anchor nw -bordermode ignore } } proc how_to_connect {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .h2connect] { wm withdraw .h2connect wm deiconify .h2connect } else { toplevel .h2connect set newgeo 340x240 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .h2connect $newgeo .h2connect config -bg $main_window_color ### # Widget Setup ### label .h2connect.labconnect -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {How to Connect} label .h2connect.labtext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "First, \ select the host you want to connect\nto in the box on the left side of \ the main\nwindow. If there are no hosts there, read\nthe \"How to Create \ a New Connection\" section\nof the manual first.\n\nOnce you have \ selected the host, click the\n\"Connect\" button. A new command shell \ will\nopen and connect you to the host that\nyou have selected." button .h2connect.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .h2connect} ###### # Now place the buttons in the winder ###### place .h2connect.labconnect \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .h2connect.labtext \ -x 10 -y 50 -width 320 -height 140 -anchor nw -bordermode ignore place .h2connect.butclose \ -x 130 -y 200 -width 80 -anchor nw -bordermode ignore } } proc how_to_new {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .h2new] { wm withdraw .h2new wm deiconify .h2new } else { toplevel .h2new set newgeo 340x400 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .h2new $newgeo .h2new config -bg $main_window_color ### # Widget Setup ### label .h2new.labnew -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {How to Make a New \ Connection} label .h2new.labtext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "First, \ click the \"New\" button.\n\nA window will appear labeled \"Connection \ Setup\"\nwith several empty fields. Fill in the \"Name\" field\nwith the \ name that you want to identify the\nconnection by. Next, fill in the \ \"Hostname\"\n field with the name of the computer you want to\nconnect \ to (like gate.eng.auburn.edu). In the\n\"Login ID\" field, enter the \ name you use when\nyou login to that computer.\n\nAt this point, there \ are some special\noptions that you can use. You can enter\nyour \ password and click the\"Save Password\"\noption if you like. \ \n\nWhen you have filled in these fields, click \"Save\"\nand \ you will be ready to use SSH Buddy." button .h2new.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .h2new} ###### # Now place the buttons in the winder ###### place .h2new.labnew \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .h2new.labtext \ -x 10 -y 50 -width 320 -height 300 -anchor nw -bordermode ignore place .h2new.butclose \ -x 130 -y 360 -width 80 -anchor nw -bordermode ignore } } proc how_to_edit {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .h2edit] { wm withdraw .h2edit wm deiconify .h2edit } else { toplevel .h2edit set newgeo 340x270 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .h2edit $newgeo .h2edit config -bg $main_window_color ### # Widget Setup ### label .h2edit.labedit -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {How to Edit a \ Connection} label .h2edit.labtext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "First, \ select the host you want to edit from\nthe box on the left side of \ the main\nwindow. If there are no hosts there, read\nthe \"How to Create \ a New Connection\" section\nof the manual first.\n\nOnce you have \ selected the host, click the\n\"Edit\" button. A window named \ \"Connection\nSetup\" will appear containing several fields\nwhich you \ saw when you created the connection\nfor the first time. Edit these as \ appropriate,\nthen click the \"Save\" button." button .h2edit.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .h2edit} ###### # Now place the buttons in the winder ###### place .h2edit.labedit \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .h2edit.labtext \ -x 10 -y 50 -width 320 -height 170 -anchor nw -bordermode ignore place .h2edit.butclose \ -x 130 -y 230 -width 80 -anchor nw -bordermode ignore } } proc how_to_delete {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .h2delete] { wm withdraw .h2delete wm deiconify .h2delete } else { toplevel .h2delete set newgeo 340x260 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .h2delete $newgeo .h2delete config -bg $main_window_color ### # Widget Setup ### label .h2delete.labdelete -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {How to Delete a \ Connection} label .h2delete.labtext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "First, \ select the connection you want to delete\nfrom the box on the left side \ of the main\nwindow. If there are no hosts there, this function\nis not \ useful.\n\nOnce you have selected the connection you wish\nto delete, \ click the \"Delete\" button. You\nwill be prompted to make sure if you \ really\nwant to remove the connection. Choose \"Really\nDelete\" to \ delete the connection or \"Cancel\" to\nkeep the connection." button .h2delete.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .h2delete} ###### # Now place the buttons in the winder ###### place .h2delete.labdelete \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .h2delete.labtext \ -x 10 -y 50 -width 320 -height 160 -anchor nw -bordermode ignore place .h2delete.butclose \ -x 130 -y 220 -width 80 -anchor nw -bordermode ignore } } proc how_to_advanced {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .h2advanced] { wm withdraw .h2advanced wm deiconify .h2advanced } else { toplevel .h2advanced set newgeo 340x260 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .h2advanced $newgeo .h2advanced config -bg $main_window_color ### # Widget Setup ### label .h2advanced.labadvanced -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {How to Use Advanced Options} label .h2advanced.labtext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "SSH \ Buddy can use a custom script to connect.\nAll you \ need is a \"Name\" for the connection and a\n\"Script to Execute.\"\ Any other information you\ngive is saved but ignored.\n\nSSH Options are any \ options you want to pass to\nssh when not using a custom script." button .h2advanced.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .h2advanced} ###### # Now place the buttons in the winder ###### place .h2advanced.labadvanced \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .h2advanced.labtext \ -x 10 -y 50 -width 320 -height 160 -anchor nw -bordermode ignore place .h2advanced.butclose \ -x 130 -y 220 -width 80 -anchor nw -bordermode ignore } } ####################################################### # PROCEDURES FOR CONNECT ####################################################### proc SSH_Buddy_Manual {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .buddy_manual] { wm deiconify .buddy_manual } else { toplevel .buddy_manual set newgeo 340x290 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .buddy_manual $newgeo .buddy_manual config -bg $main_window_color ### # Widget Setup ### label .buddy_manual.labmanual -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {SSH Buddy Manual} button .buddy_manual.butconnect -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text "How to Connect" \ -command {how_to_connect} button .buddy_manual.butnew -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text "How to Create a New Connection" \ -command {how_to_new} button .buddy_manual.butedit -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text "How to Edit a Connection" \ -command {how_to_edit} button .buddy_manual.butdelete -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text "How to Delete a Connection" \ -command {how_to_delete} button .buddy_manual.butadvanced -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text "How to Use Advanced Options" \ -command {how_to_advanced} button .buddy_manual.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .buddy_manual} ###### # Now place the buttons in the winder ###### place .buddy_manual.labmanual \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .buddy_manual.butconnect \ -x 10 -y 50 -width 320 -anchor nw -bordermode ignore place .buddy_manual.butnew \ -x 10 -y 90 -width 320 -anchor nw -bordermode ignore place .buddy_manual.butedit \ -x 10 -y 130 -width 320 -anchor nw -bordermode ignore place .buddy_manual.butdelete \ -x 10 -y 170 -width 320 -anchor nw -bordermode ignore place .buddy_manual.butadvanced \ -x 10 -y 210 -width 320 -anchor nw -bordermode ignore place .buddy_manual.butclose \ -x 130 -y 250 -width 80 -anchor nw -bordermode ignore } } proc contact_box {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .conbox] { wm withdraw .conbox wm deiconify .conbox } else { toplevel .conbox wm title .conbox "Contact" set newgeo 340x190 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .conbox $newgeo .conbox config -bg $main_window_color ### # Widget Setup ### label .conbox.labcontact -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {Contact} label .conbox.labcontext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "SSH Buddy \ was created by\n\nCharles Wright (wrighrc@eng.auburn.edu)\nWilliam Sutton \ (suttowr@eng.auburn.edu)\n\nWe hope you enjoy using it." button .conbox.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .conbox} ###### # Now place the buttons in the winder ###### place .conbox.labcontact \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .conbox.labcontext \ -x 10 -y 50 -width 320 -height 90 -anchor nw -bordermode ignore place .conbox.butclose \ -x 130 -y 150 -width 80 -anchor nw -bordermode ignore } } proc about_box {} { global main_window_color button_text button_color # first we must see if the window exists if [winfo exists .abox] { wm withdraw .abox wm deiconify .abox } else { toplevel .abox wm title .abox "About" set newgeo 340x150 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .abox $newgeo .abox config -bg $main_window_color ### # Widget Setup ### label .abox.lababout -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {About} ## ## CHANGE VERSION HERE ## label .abox.labatext -background $main_window_color -foreground \ $button_text -borderwidth 1 -relief flat -justify left -text "Version Beta1.05\n\nSSH Buddy \ was created by Charles Wright\nand William Sutton." button .abox.butclose -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Close \ -command {wm withdraw .abox} ###### # Now place the buttons in the winder ###### place .abox.lababout \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .abox.labatext \ -x 10 -y 50 -width 320 -height 50 -anchor nw -bordermode ignore place .abox.butclose \ -x 130 -y 110 -width 80 -height 30 -anchor nw -bordermode ignore } } proc {pack_list} {} { global data_file hostname_array login_array passwd_array sshopts_array custom_array set name "" .listfr.list delete 0 end if [file exists $data_file] then { set fileId [open $data_file r 0600] while {[gets $fileId line] >= 0} { if {"nm" == "[string range $line 0 1]"} then { if {"$name" != ""} then { .listfr.list insert end $name} set name [string range $line 3 end] ## I set to "" here so we don't have any accidently undefineds anywhere set hostname_array($name) "" set login_array($name) "" set passwd_array($name) "" set sshopts_array($name) "" set custom_array($name) "" } if {"hn" == "[string range $line 0 1]"} then { set hostname_array($name) [string range $line 3 end] } if {"lg" == "[string range $line 0 1]"} then { set login_array($name) [string range $line 3 end] } if {"pw" == "[string range $line 0 1]"} then { set passwd_array($name) [string range $line 3 end] } if {"op" == "[string range $line 0 1]"} then { set sshopts_array($name) [string range $line 3 end] } if {"cu" == "[string range $line 0 1]"} then { set custom_array($name) [string range $line 3 end] } } ; #END WHILE .listfr.list insert end $name close $fileId } } ; #END packlist proc {connect_clicked} {} { global expect_path term termopts termexe global hostname_array login_array passwd_array custom_array global sshbuddyhome global main_window_color button_color button_text if { "[.listfr.list curselection]" == "" } then { if {[winfo exists .warning1]} { wm withdraw .warning1 wm deiconify .warning1; return } ################### # CREATING WIDGETS ################### toplevel .warning1 set newgeo 309x104 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .warning1 $newgeo wm deiconify .warning1 wm title .warning1 "Connect Error" .warning1 config -bg $main_window_color text .warning1.texwarn .warning1.texwarn insert 1.0 " You must select what you want to\n" .warning1.texwarn insert 2.0 " Connect to before hitting the\n" .warning1.texwarn insert 3.8 " Connect Button." .warning1.texwarn config -state disabled button .warning1.butok \ -background $button_color -foreground $button_text \ -padx 11 -pady 4 -text Ok -command {wm withdraw .warning1} ################### # SETTING GEOMETRY ################### place .warning1.texwarn \ -x 15 -y 10 -width 283 -height 50 -anchor nw -bordermode ignore place .warning1.butok \ -x 15 -y 70 -width 286 -height 28 -anchor nw -bordermode ignore } else { set name_of_selected_lbox_entry [.listfr.list get [.listfr.list curselection]] ################################################# # # and call the file we made in save_clicked # ################################################# if {"$custom_array($name_of_selected_lbox_entry)" != ""} then { eval {spawn} $term $termopts $termexe {$custom_array($name_of_selected_lbox_entry)} } else { eval {spawn} $term $termopts $termexe {$sshbuddyhome/$name_of_selected_lbox_entry} } } ; # ELSE } ; # END connect_clicked ####################################################### # PROCEDURES FOR CONNECTSETUP ####################################################### proc {really_delete} {} { global hostname_array login_array passwd_array sshopts_array custom_array data_file sshbuddyhome # we know that this will work here. set name [.listfr.list get [.listfr.list curselection]] # delete the expect file in the # rm $sshbuddyhome/$name file delete "$sshbuddyhome/$name" set fileId [open $data_file w 0600] foreach ind [ lsort -dictionary [array names hostname_array] ] { if {"$ind" != "$name"} then { puts $fileId "nm $ind" if {"$hostname_array($ind)" != ""} then { puts $fileId "hn $hostname_array($ind)" } if {"$login_array($ind)" != ""} then { puts $fileId "lg $login_array($ind)" } if {"$passwd_array($ind)" != ""} then { puts $fileId "pw $passwd_array($ind)" } if {"$sshopts_array($ind)" != ""} then { puts $fileId "op $sshopts_array($ind)" } if {"$custom_array($ind)" != ""} then { puts $fileId "cu $custom_array($ind)" } } ; # endif } ; # END foreach close $fileId unset hostname_array unset login_array unset passwd_array unset sshopts_array unset custom_array pack_list } proc {delete_entry} { name } { global hostname_array login_array passwd_array data_file global main_window_color button_color button_text if { "$name" == "" } then { if {[winfo exists .warning2]} { wm withdraw .warning2 wm deiconify .warning2; return } ################### # CREATING WIDGETS ################### toplevel .warning2 set newgeo 309x104 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .warning2 $newgeo wm deiconify .warning2 wm title .warning2 "Delete Error" .warning2 config -bg $main_window_color text .warning2.texwarn .warning2.texwarn insert 1.0 " You must select what you want to\n" .warning2.texwarn insert 2.0 " Delete before hitting the\n" .warning2.texwarn insert 3.8 " Delete Button." .warning2.texwarn config -state disabled button .warning2.butok \ -background $button_color -foreground $button_text \ -padx 11 -pady 4 -text Ok -command {wm withdraw .warning2} ################### # SETTING GEOMETRY ################### place .warning2.texwarn \ -x 15 -y 10 -width 283 -height 50 -anchor nw -bordermode ignore place .warning2.butok \ -x 15 -y 70 -width 286 -height 28 -anchor nw -bordermode ignore } else { if {[winfo exists .confirm]} { wm withdraw .confirm wm deiconify .confirm; return } ################### # CREATING WIDGETS ################### toplevel .confirm -class Toplevel set newgeo "" set newgeo 289x148 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .confirm $newgeo wm deiconify .confirm wm title .confirm "Confirm Delete" .confirm config -bg $main_window_color text .confirm.tex1 .confirm.tex1 insert 1.0 " Are you sure you want \n " .confirm.tex1 insert 2.0 " to Delete this connection?\n" .confirm.tex1 config -state disabled button .confirm.butdelete \ -padx 11 -pady 4 -text {Really Delete} \ -background $button_color -foreground $button_text \ -command { really_delete ; wm withdraw .confirm} \ button .confirm.butcancel \ -padx 11 -pady 4 -text Cancel \ -background $button_color -foreground $button_text \ -command { wm withdraw .confirm} ################### # SETTING GEOMETRY ################### place .confirm.tex1 \ -x 25 -y 20 -width 233 -height 60 -anchor nw -bordermode ignore place .confirm.butdelete \ -x 120 -y 95 -width 136 -height 28 -anchor nw -bordermode ignore place .confirm.butcancel \ -x 25 -y 95 -width 71 -height 28 -anchor nw -bordermode ignore #### # END Confirm Delete Box ############################ } ; # END else } proc {clicked_save_passwd} {} { .connectsetup.entpasswd configure -state normal } proc {cancel_advanced} {} { global name sshopts sshopts_array custom custom_array # is name defined here and if { "$name" != "" } then { set sshopts $sshopts_array($name) set custom $custom_array($name) } else { set sshopts "" set custom "" } } proc {advanced} {} { # # Have a global sshopts # set sshopts when connecting # set sshopts when hitting the save button # # save sshopts when global main_window_color button_text button_color global term termopts termexe sshopts custom if [winfo exists .advanced] then { wm deiconify .advanced } else { toplevel .advanced wm title .advanced {Advanced Settings} .advanced config -bg $main_window_color set newgeo 360x260 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .advanced $newgeo wm maxsize .advanced 1265 946 wm minsize .advanced 1 1 ########################## # SSH Options ########################## label .advanced.labsshhead \ -background $button_color -foreground $button_text \ -borderwidth 1 -relief raised -text "SSH Command-Line Options" label .advanced.labssh \ -background $button_color -foreground $button_text \ -borderwidth 1 -relief raised -text "SSH Options" entry .advanced.entsshopts \ -background $button_color -foreground $button_text \ -textvariable {sshopts} ########################### Added in Beta1.04 ################################## label .advanced.labcust \ -background $button_color -foreground $button_text \ -borderwidth 1 -relief raised -text "Use Custom Script to Connect" label .advanced.labcustom \ -background $button_color -foreground $button_text \ -borderwidth 1 -relief raised -text "Script to Execute" entry .advanced.entcustom \ -background $button_color -foreground $button_text \ -textvariable {custom} button .advanced.butcancel \ -background $button_color -foreground $button_text \ -padx 11 -pady 4 -text "Cancel Changes" \ -command { cancel_advanced ; wm withdraw .advanced } button .advanced.butsave \ -background $button_color -foreground $button_text \ -padx 11 -pady 4 -text "Save Changes" \ -command { wm withdraw .advanced } ###################### # ADVANCED OPTIONS ###################### place .advanced.labsshhead \ -x 10 -y 5 -width 340 -height 18 -anchor nw -bordermode ignore place .advanced.labssh \ -x 20 -y 35 -width 150 -height 28 -anchor nw -bordermode ignore place .advanced.entsshopts \ -x 190 -y 35 -width 150 -height 28 -anchor nw -bordermode ignore place .advanced.labcust \ -x 10 -y 130 -width 340 -height 18 -anchor nw -bordermode ignore place .advanced.labcustom \ -x 20 -y 160 -width 150 -height 28 -anchor nw -bordermode ignore place .advanced.entcustom \ -x 190 -y 160 -width 150 -height 28 -anchor nw -bordermode ignore place .advanced.butcancel \ -x 10 -y 220 -width 125 -anchor nw -bordermode ignore place .advanced.butsave \ -x 225 -y 220 -width 125 -anchor nw -bordermode ignore } } proc {unpack_connectionsetup} {} { if {[winfo exists .connectsetup]} { wm withdraw .connectsetup if {[winfo exists .advanced]} { wm withdraw .advanced } } } proc {edit_or_new_clicked} { name } { global hostname_array login_array passwd_array sshopts sshopts_array custom custom_array global main_window_color button_text button_color global save if { "$name" == "" } then { ####################################################### # WARNING EDIT CLICKED WITHOUT SELECTING WHAT TO EDIT ####################################################### if {[winfo exists .warning3]} { wm withdraw .warning3 wm deiconify .warning3; return } ################### # CREATING WIDGETS ################### toplevel .warning3 set newgeo "" set newgeo 309x104 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .warning3 $newgeo wm deiconify .warning3 wm title .warning3 "Edit Error" .warning3 config -bg $main_window_color text .warning3.texwarn .warning3.texwarn insert 1.0 " You must select what you want to\n" .warning3.texwarn insert 2.0 " Edit before hitting the\n" .warning3.texwarn insert 3.8 " Edit Button." .warning3.texwarn config -state disabled button .warning3.butok \ -background $button_color -foreground $button_text \ -padx 11 -pady 4 -text Ok -command {wm withdraw .warning3} ################### # SETTING GEOMETRY ################### place .warning3.texwarn \ -x 15 -y 10 -width 283 -height 50 -anchor nw -bordermode ignore place .warning3.butok \ -x 15 -y 70 -width 286 -height 28 -anchor nw -bordermode ignore } else { ####################### # ITS A NEW CONNECTION OR EDIT AN OLD ONE ######################## if {"$name" == "NEW"} then { set name "" set sshopts "" set custom "" } else { set name [.listfr.list get $name] } if [winfo exists .connectsetup] { wm deiconify .connectsetup ##################################################### # we must clean out the boxes and unselect checkboxes ##################################################### .connectsetup.chesave deselect .connectsetup.entname delete 0 end .connectsetup.enthostname delete 0 end .connectsetup.entlogin delete 0 end .connectsetup.entpasswd delete 0 end } else { toplevel .connectsetup set newgeo "" set newgeo 340x290 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .connectsetup $newgeo .connectsetup config -bg $main_window_color ### # Widget Setup ### entry .connectsetup.entname -background $button_color -foreground \ $button_text -textvariable {name} label .connectsetup.labsetup -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {Connection Setup} label .connectsetup.labname -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {Name } label .connectsetup.labhostname -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text Hostname entry .connectsetup.enthostname -background $button_color -foreground \ $button_text -textvariable {hostname} label .connectsetup.labloginid -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text {Login ID} label .connectsetup.labpasswd -background $button_color -foreground \ $button_text -borderwidth 1 -relief raised -text Password entry .connectsetup.entlogin -background $button_color -foreground \ $button_text -textvariable {login} checkbutton .connectsetup.chesave -background $button_color -foreground \ $button_text -text {save password} -variable save \ -command clicked_save_passwd entry .connectsetup.entpasswd -background $button_color -foreground \ $button_text -textvariable {passwd} \ -show * \ -state disabled button .connectsetup.butadvanced -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text "Advanced Options" -command advanced button .connectsetup.butcancel -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Cancel -command unpack_connectionsetup button .connectsetup.butsave -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Save -command save_click button .connectsetup.buthelp -background $button_color -foreground \ $button_text -padx 9 -pady 3 -text Help -command how_to_new ###### # Now place the buttons in the winder ###### place .connectsetup.labsetup \ -x 10 -y 10 -width 320 -height 20 -anchor nw -bordermode ignore place .connectsetup.labname \ -x 10 -y 50 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.entname \ -x 180 -y 50 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.labhostname \ -x 10 -y 80 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.enthostname \ -x 180 -y 80 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.labloginid \ -x 10 -y 110 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.entlogin \ -x 180 -y 110 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.chesave \ -x 180 -y 140 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.labpasswd \ -x 10 -y 140 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.entpasswd \ -x 180 -y 165 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.butadvanced \ -x 180 -y 200 -width 150 -height 20 -anchor nw -bordermode ignore place .connectsetup.butsave \ -x 250 -y 250 -width 80 -anchor nw -bordermode ignore place .connectsetup.butcancel \ -x 110 -y 250 -width 80 -anchor nw -bordermode ignore place .connectsetup.buthelp \ -x 10 -y 250 -width 80 -anchor nw -bordermode ignore } ; # END ELSE ###### # Set the defaults ###### if { "$name" != "" } { # # Set sshopts and custom # set sshopts "$sshopts_array($name)" set custom "$custom_array($name)" .connectsetup.entname insert 0 "$name" .connectsetup.enthostname insert 0 "$hostname_array($name)" .connectsetup.entlogin insert 0 "$login_array($name)" # p.s. its ok to insert a null # that is why I set the passwd to null if you don't want to # save it :) # now if the password is "" then they didn't want to save it # so we deselect the check if { "$passwd_array($name)" == "" } { .connectsetup.chesave deselect .connectsetup.entpasswd configure -state disabled } else { .connectsetup.chesave select .connectsetup.entpasswd configure -state normal .connectsetup.entpasswd insert 0 "$passwd_array($name)" } } } } proc save_click {} { global name hostname login passwd custom_array custom save sshbuddyhome expect_path global data_file hostname_array login_array passwd_array sshopts_array sshopts global main_window_color button_text button_color if { "$name" != ""} then { set hostname_array($name) "$hostname" set login_array($name) "$login" set passwd_array($name) "$passwd" set sshopts_array($name) "$sshopts" set custom_array($name) "$custom" #### # WRITE THE EXPECT FILE HERE ################################ if { "$custom" == ""} then { set fileId [open "$sshbuddyhome/$name" w 0700] puts $fileId "#!$expect_path" ### # NEW IN Beta1.05 ### puts $fileId "trap {" puts $fileId "stty rows \[stty rows\] columns \[stty columns\] < \$spawn_out(slave,name)" puts $fileId "} WINCH" if { "$passwd_array($name)" != "" && "$save" == "1" } { puts $fileId "spawn ssh -l $login_array($name) $sshopts_array($name) $hostname_array($name)" puts $fileId "expect {" puts $fileId "\"(yes/no)?\" {exp_send \"yes\\r\"" puts $fileId "expect \"password:\"" puts $fileId "log_user 0" puts $fileId "exp_send \"$passwd_array($name)\\r\"" puts $fileId "expect -ex \"$passwd_array($name)\"" puts $fileId "log_user 1" puts $fileId "}" puts $fileId "\"password:\" {" puts $fileId "log_user 0" puts $fileId "exp_send \"$passwd_array($name)\\r\"" puts $fileId "expect -ex \"$passwd_array($name)\"" puts $fileId "log_user 1}" puts $fileId "}" puts $fileId "interact" close $fileId } else { # write no pass & clear out the passwd_array set passwd_array($name) "" puts $fileId "spawn ssh -l $login_array($name) $sshopts_array($name) $hostname_array($name)" puts $fileId "interact" close $fileId } } ### # DONE WRITING THE EXPECT FILE ################################### set fileId [open $data_file w 0600] # Need if statements and only put the option if it isn't "" # Makes config file shorter and aids in backward compatible idea foreach ind [ lsort -dictionary [array names hostname_array] ] { puts $fileId "nm $ind" if { "$hostname_array($ind)" != "" } then { puts $fileId "hn $hostname_array($ind)" } if { "$login_array($ind)" != "" } then { puts $fileId "lg $login_array($ind)" } if { "$passwd_array($ind)" != "" } then { puts $fileId "pw $passwd_array($ind)" } if { "$sshopts_array($ind)" != "" } then { puts $fileId "op $sshopts_array($ind)" } if { "$custom_array($ind)" != "" } then { puts $fileId "cu $custom_array($ind)" } } ; # END foreach close $fileId unpack_connectionsetup pack_list } else { if {[winfo exists .warning10]} { wm withdraw .warning10 wm deiconify .warning10; return } ################### # CREATING WIDGETS ################### toplevel .warning10 set newgeo "" set newgeo 309x104 set curgeo [winfo geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] wm geometry .warning10 $newgeo wm deiconify .warning10 wm title .warning10 "Save Error" .warning10 config -bg $main_window_color text .warning10.texwarn .warning10.texwarn insert 1.0 " You must enter a NAME for the \n" .warning10.texwarn insert 2.0 " Connection.\n" .warning10.texwarn config -state disabled button .warning10.butok \ -background $button_color -foreground $button_text \ -padx 11 -pady 4 -text Ok -command {wm withdraw .warning10} ################### # SETTING GEOMETRY ################### place .warning10.texwarn \ -x 15 -y 10 -width 283 -height 50 -anchor nw -bordermode ignore place .warning10.butok \ -x 15 -y 70 -width 286 -height 28 -anchor nw -bordermode ignore } ; # END ELSE } ; # END save_click proc exit_normal {} { global geo_file set fileId [open $geo_file w 0600] set newgeo 310x240 set curgeo [wm geometry .] set len [string length curgeo] for {set i 0} {$i < $len} {incr i} { if {"[string index curgeo $i]"=="+"} then { break } } append newgeo [string range $curgeo [expr $i + 1] end] puts $fileId $newgeo close $fileId exit } ######################################### # scroll bar procedures from tcl book ######################################### proc Scroll_Set {scrollbar geoCmd offset size} { if {$offset != 0.0 || $size != 1.0} { eval $geoCmd } $scrollbar set $offset $size } proc Scrolled_Listbox { f args } { frame $f listbox $f.list \ -xscrollcommand [list Scroll_Set $f.xscroll \ [list grid $f.xscroll -row 1 -column 0 -sticky we]] \ -yscrollcommand [list Scroll_Set $f.yscroll \ [list grid $f.yscroll -row 0 -column 1 -sticky ns]] eval {$f.list configure} $args scrollbar $f.xscroll -orient horizontal \ -command [list $f.list xview] scrollbar $f.yscroll -orient vertical \ -command [list $f.list yview] grid $f.list -sticky news grid rowconfigure $f 0 -weight 1 grid columnconfigure $f 0 -weight 1 return $f.list } ##################################################### # THE MAIN WINDOW SETUP (CONNECT) ##################################################### ######################### # MENU ######################### menu .menubar . config -menu .menubar foreach m {Program} { set $m [menu .menubar.m$m] .menubar add cascade -label $m -menu .menubar.m$m } set Help [menu .menubar.mHelp] .menubar add cascade -label Help -menu .menubar.mHelp $Program add command -label Settings -command change_settings $Program add command -label Exit -command exit_normal $Help add command -label "Users Manual" -command SSH_Buddy_Manual $Help add command -label "About SSH Buddy" -command about_box $Help add command -label "Contact Info" -command contact_box ########################### # END TOP MENU # ########################### if [file exists $geo_file] then { set fileId [open $geo_file r 0600] gets $fileId line wm geometry . $line close $fileId } else { wm geometry . 310x240+100+100 } wm title . "SSH Buddy" wm protocol . WM_DELETE_WINDOW exit_normal . config -bg $main_window_color Scrolled_Listbox .listfr -background $button_color -foreground $button_text label .labsshbuddy \ -borderwidth 1 -relief raised -text {SSH Buddy} \ -background $button_color -foreground $button_text label .labselectconnect \ -borderwidth 1 -relief raised -text {Select a Connection(s)} \ -background $button_color -foreground $button_text button .butedit \ -padx 9 -pady 3 -text "Edit " \ -command {edit_or_new_clicked [.listfr.list curselection]} \ -background $button_color -foreground $button_text button .butnew \ -padx 9 -pady 3 -text "New " \ -command {edit_or_new_clicked "NEW"} \ -background $button_color -foreground $button_text button .butdelete \ -padx 9 -pady 3 -text "Delete" \ -command {delete_entry [.listfr.list curselection]} \ -background $button_color -foreground $button_text button .but24 \ -padx 9 -pady 3 -text {Connect} -command connect_clicked \ -background $button_color -foreground $button_text label .labeditconnect \ -borderwidth 1 -relief raised -text {Edit / Insert Connection} \ -background $button_color -foreground $button_text pack_list proc rewritescripts {} { global name hostname login passwd custom_array custom save sshbuddyhome expect_path global data_file hostname_array login_array passwd_array sshopts_array sshopts global main_window_color button_text button_color foreach index [ array names hostname_array ] { set name $index set hostname "$hostname_array($index)" set login "$login_array($index)" set passwd "$passwd_array($index)" if { "$passwd_array($index)" != "" } { set save 1 } else { set save 0 } set sshopts "$sshopts_array($index)" set custom "$custom_array($index)" save_click } } if [file exists $vers_file] then { set fileId [open $vers_file r 0600] gets $fileId line if {"$line" == "Beta1.05"} then { close $fileId } else { rewritescripts close $fileId set fileId [open "$vers_file" w 0700] puts $fileId "Beta1.05" close $fileId } } else { rewritescripts set fileId [open "$vers_file" w 0700] puts $fileId "Beta1.05" close $fileId } ################### # SETTING GEOMETRY ################### place .labsshbuddy \ -x 10 -y 10 -width 290 -height 20 -anchor nw -bordermode ignore place .listfr -x 10 -y 50 -width 170 -height 181 place .but24 \ -x 200 -y 50 -width 100 -anchor nw -bordermode ignore place .butedit \ -x 200 -y 145 -width 100 -anchor nw -bordermode ignore place .butnew \ -x 200 -y 105 -width 100 -anchor nw -bordermode ignore place .butdelete \ -x 200 -y 200 -width 100