sergelaurent
Technical User
Hi, I got the following code
for {set i 0} {$i<20} {incr i} {
#Creation des différents buttons
set j [expr $i+2]
set "temp_nom" "c:\\Laurent\\sauvegarde\\$nom($i).*"
puts $"temp_nom"
button ".test.f.b$j" -text $nom($i) -command { \
exec {C:\Program Files\Microsoft Office\Office\WINWORD.EXE} $"temp_nom$i"
} -justify center
#Placement du button
pack configure ".test.f.b$j" -side top
}
I would like to create 20 different buttons. However, when clicking on each button, it always open the same file. I have concluded that since the command is executed only when I activate the button, it seems logical that I open on the the file attributed to button19.
So I wanted to know how I can male each button open a file or a few files when using a loop?
Thanks in advance,
lolo
for {set i 0} {$i<20} {incr i} {
#Creation des différents buttons
set j [expr $i+2]
set "temp_nom" "c:\\Laurent\\sauvegarde\\$nom($i).*"
puts $"temp_nom"
button ".test.f.b$j" -text $nom($i) -command { \
exec {C:\Program Files\Microsoft Office\Office\WINWORD.EXE} $"temp_nom$i"
} -justify center
#Placement du button
pack configure ".test.f.b$j" -side top
}
I would like to create 20 different buttons. However, when clicking on each button, it always open the same file. I have concluded that since the command is executed only when I activate the button, it seems logical that I open on the the file attributed to button19.
So I wanted to know how I can male each button open a file or a few files when using a loop?
Thanks in advance,
lolo