Subscribe: ActiveState Code: Tcl recipes
Added By: Feedage Forager Feedage Grade B rated
Language: English
copy  data  directory  dis  error  file  message  package  ptrack  revision  script  source  tcl recipe  tcl tcl recipe  tcl  text  udp 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: ActiveState Code: Tcl recipes

Popular Tcl recipes

ActiveState Code Recipes

Updated: 2017-04-10T13:51:58-07:00


diff_copy.tcl Utility for daily differential backups of large windows directory structures (Tcl)


Tcl recipe 580779 by John Brearley (backup, daily, tcl).

When you have terrabytes of data with 100,000+ files, it is no longer practical to blindly copy the entire data structure on a daily basis. I wrote this utility diff_copy.tcl to sort out what has been changed/updated and what new files have been added and only copy the changed & new items. If the date/time of the source file is newer, the file will be copied. If the date/time of the source file is the same as the destination, the file sizes in bytes are checked to decide if a copy is necessary. If the source file is not present on the destination directory, the file is copied. There are options to remove old files from the destination directory or show what would be copied, but not actually do the copy.

Recursive fc/diff for Windows, optionally copy missing/different files (Tcl)


Tcl recipe 580776 by John Brearley (compare, file, tcl).

Utility to add recursive capability to fc.exe on Windows. Will optionally copy/update missing or older files as needed. If you have a diff.exe in your path, say from having installed TkDiff utility, the diff.exe will be used as the prirmary compare tool, with fc.exe as the backup tool.

A Simple Calculator (Tcl)


Tcl recipe 578929 by Mike Manilone (calculator, gui).

A simple calculator. Calculation is done by [expr].

Stopwatch in 26 lines (Tcl)


Tcl recipe 578927 by Mike Manilone (gui, time).

This stopwatch works on Tcl/Tk 8.5 and higher. It makes use of the [clock] command and reduced the amount of code by -textvariable. A simple one, indeed. Nevertheless, it is still easy-to-read and easy-to-understand and it does show the power that Tcl has.

Track Debug Package argument(s) are option(s) and/or a debug message to be saved to a file (Tcl)


Tcl recipe 578855 by Bert Byfield (debugging, pdisplay, ptrack, trace, track, tracklst).

package require tracks

pTrack ?-on? ?-off? ?-clear? ?-overflow? ?-overflowGo? ?-abend? ?"104 message text"?

A user-specified text message is written to a file "tracklst.txt" in the same directory as the source program. Tracking can be turned on or off, and the clear option sets the file to zero bytes. The program defaults to raise an error if the tracklst.txt file gets too big (default is one megabyte), but the overflowGo option will cause it to just turn off tracking and continue. The abend option will raise an optional error. The message is whatever the user wants it to be, but suggested usage is to always start with three digits that identify a proc and a fourth alphabetic character that marks the track uniquely and allows searching for a specific track. Also includes pDisplay, which writes a debug message to a tk_messageBox dialog window.

e.g.: pTrack -clear "Start a new test by emptying the track file"
pTrack "140d date adjusted to $tMon of $tYear" pTrack "135b Current working directory is [pwd]"

Poker hand calculation and comparison (Tcl)


Tcl recipe 578539 by Magnus Åhman (poker). Revision 2.

Calculates 1. the category of the hand (high card, one pair, etc...) and 2. the "kicker" values that act as tiebreakers to (possibly) distinguish two hands of the same category from each other. These two attributes, category and kickers, are then used by the cmp method to compare two hand objects and return -1, 0 or 1.

Sample script for TCL socket load distribution across many CPUs / hosts (Tcl)


Tcl recipe 578351 by John Brearley (distribution, load, socket, tcl).

Here is a demo script for others to reuse / learn from. The server process hands out work assignments to multiple children process to do load balancing across multiple CPUs / hosts. The children process in this sample script dont do any real work, but occasionally create an error to demonstrate the error handling and recovery. Enjoy!

Basic Text Editor (Tcl)


Tcl recipe 577617 by Jonathan Fenech (basic, editor, text).

Text editor with copy,cut and paste functions.

Spawn command not found error (Tcl)


Tcl recipe 577408 by siva prasad .

Installed ActiveTCL and executed the commands "teacup install --force Expect".

I executed a script which will telnet to given ip.The following is the error.

The system cannot find the file specified. while executing "spawn telnet $Machine".

let me know,anything missed ?

Thanks, Siva.

iTunes control (Tcl)


Tcl recipe 577165 by Frank Bannon (itunes, tcom).

Simple TCL commands can control your iTunes player, add network control, or create an alternate interface. This recipe uses the tcom package on Windows.

Parse a DIS PDU (Tcl)


Tcl recipe 576892 by Frank Bannon (dis, pdu, udp).

Decodes Distributed Interactive Simulation (DIS) Protocol Data Units (PDUs) from UDP packets. Requires UDP package (

Entity State (1), Fire (2), and Detonation (3) PDUs are decoded.

Distributed Interactive Simulation (Tcl)


Tcl recipe 576568 by Frank Bannon (dis, pdu, udp). Revision 2.

Decode Distributed Interactive Simulation (DIS) Protocol Data Units (PDUs) captured from UDP packets. PDUs decoded: Entity State, Fire, Detonation, Transmitter, Signal. Captures a packet from UDP, then decodes the data and adds it to a log.

Pronouncable password generator (Tcl)


Tcl recipe 544293 by Rob Haeusler .

I wanted a GUI pronouncable password generator that was not Internet based, that would meet the password rules required by the various systems that I work with. I've used a basic python program (non-GUI) modified to tcl/tk.

Script checking availability of network servers (Tcl)


Tcl recipe 528899 by Alex Khokhlov (sysadmin). Revision 2.

Script checking availability of network servers If the server is not accessible, starts action The necessary data are read from a text file

The file of the data contains lines of a kind:

smtp_server:25:any_executed_program:my_smtp_server httpd_daemon:80:ps:corp_web_server

what words and phrases phone number spells (Tcl)


Tcl recipe 528866 by Slava Lysunkin .

This simple TCL script can generate all possible variants of pnone number spells using numbers and letters

Minor enhancement to the base Tk Console. Additional change. (Tcl)


Tcl recipe 523001 by Mike Collins . Revision 2.

Right click Copy and Paste. And when you source a script from the command line, you lose the focus, and have to click the mouse button somewhere in the console screen to be able to type again. Fixed that around line # 616. Inserted "focus $w" and now it works better.

dumpThreads (Tcl)


Tcl recipe 502208 by Patrick Finnegan (websphere). Revision 2.

Take a java core dump from a running server. Identify the working directory where the file will be placed.

Create Properties Object. Return loaded property object. (Tcl)


Tcl recipe 502196 by Patrick Finnegan (tclblend).

Uses the java Properties class to read a java formatted property file. Returns a loaded Property object. Access the properties using the get property method.

$PropertyI getProperty

Connect to Oracle DB. (Tcl)


Tcl recipe 502195 by Patrick Finnegan (tclblend).

Quick connection to Oracle Database.

Scripted Telnet Client Class (Tcl)


Tcl recipe 496990 by Flavio Salgueiro (network). Revision 2.

A simlpe Telnet Client Class utilizing Todd Martin's telnet package available at .