Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

interface between tk and shell script

Status
Not open for further replies.

desertcolt

Programmer
Nov 9, 2004
1
US
Hi all,

I am trying to write a small tk GUI which could interact with my Perl code running at back ground. So that when I click RUN button on GUI , it will take the arguments from GUI and run the Perl code on command line. Perl code takes 5 arguments, input file, output file, and three variables. It is working fine with command line. The variable interface between GUI and perl is not working and it seems that its not taking the values from GUI form. So there is some problem with the binding variables which I am trasfering to exec command in tk script.

I will be grateful if someone could help in fixing the code.

thanks


Code:
#!/usr/local/bin/wish -f

button .run -text RUN
pack .run -side right

label .label1 -text "I/P file name:"

label .label2 -text "O/P file name:"

entry .entry1 -width 20 -relief sunken -bd 2
set p {puts [.entry1 get]}

entry .entry2 -width 20 -relief sunken -bd 2
set q {puts [.entry2 get]}

pack .label1 .entry1 -side top -padx 1m -pady 2m
pack .label2 .entry2 -side top -padx 1m -pady 2m

frame .left
frame .middle
frame .right

foreach size {1024 2048 4096} {
    radiobutton .pts$size -text "$size" -relief flat -variable pts -value $size
}
set r  {puts [.pts$size get]}

foreach val {1 2 3} {
    radiobutton .vol$val -text "$val" -relief flat -variable vol -value $val
}
set s {puts [.vol$val get]}

foreach tech {65 90 130} {
    radiobutton .nano$tech -text "$tech" -relief flat -variable nano -value $tech
}
set t  {puts [.nano$tech get]}

pack .left -side left -padx 3m -pady 3m
pack .middle -side left -padx 3m -pady 3m
pack .right -side right -padx 3m -pady 3m

pack .pts1024 .pts2048 .pts4096 -in .left -side top -anchor w

pack .vol1 .vol2 .vol3 -in .middle -side top -anchor w
pack .nano65 .nano90 .nano130 -in .right -side top -anchor w

bind .run <Button-1> {exec test2.pl $p $q $r $s $t}

 
I think you need to execute perl, itself, with test2.pl being the first argument.

Bob Rashkin
rrashkin@csc.com
 
I reckon exactly the same thing as well...
try that
Code:
{exec /usr/bin/perl test2.pl $p $q $r $s $t}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top