logical programs in tcl

#1.Find the greatest number among 3 numbers using tcl
set i 10
set j 30
set k 20
if {$i>$j && $i>$k} {
puts “i is greatest :$i” } elseif {$j>$k && $j>$i} {
puts “j is the greatest :$j” } else {
puts “k is the greatest”  }

#2.Take an array and find the minimum and maximum using tcl
set a(0) 10
set a(1) 30
set . . . → Read More: logical programs in tcl

How to read data from excel in tcl and write data to excel using tcl

#1.How to create an excel and write data to that excel ,later read the data from excel and save it using tcl
#The below example explains how to write “india” in 3 rd row and A column in tcl
#Later read the same data from excel in tcl

package require tcom

set application [::tcom::ref createobject "Excel.Application"]
$application Visible 1

set workbooks [$application . . . → Read More: How to read data from excel in tcl and write data to excel using tcl

How to read file and copy to another file in tcl

# 1.copy the contents file from file1 to file2 using tcl
set fp1 [open "d:\sample.txt" "r"]
set fp2 [open "d:\sample2.txt" "w"]
while {[gets $fp1 data]>=0} {
puts $fp2 $data
}
close . . . → Read More: How to read file and copy to another file in tcl

TCL Basics

TCL (Tool Command Language)

Download tcl tutorial word

Download tcl tutorial pdf
Small Examples :

Displaying messages and values

puts India
o/p:India
puts “welcome to India”
o/p:welcome to India
puts 58
o/p:58
echo welcome to India
welcome to India

Putting Comments

#ignore this

Displaying values of variables
set x 10
o/p:10
puts $x
o/p:10

set string “welcome to India”
o/p:welcome to India
puts $string
o/p:welcome to India

puts hai ; puts bye
o/p:
hai
bye

set i hai ; set x 5 . . . → Read More: TCL Basics