#!/usr/bin/tclsh # Example 2. # Using a more intuitive interface, we buil nested structures # in which the clipboard text is stored. # The output of running this script is in 'out2.txt'. source "lib_clip.tcl" source "syn_clip.tcl" proc output {} { puts "---" cb_output tiger puts "" cb_output tail puts "---" } clip tiger { cb_puts "Hello, I am a tiger.\n" plug DATA { cb_puts "My name is " plug NAME cb_puts ".\n" ref tail cb_puts "Those were my data.\n" } cb_puts "That's all.\n" } clip tail BEGIN { plug BEGIN2 { plug BEGIN3 { cb_puts "I have a " plug VERY cb_puts "long tail.\n" } } } foreach i {1 2 3 4 5} { cb_add tail VERY t "very " } cb_add tiger NAME t "growl" output replace tiger NAME { cb_puts "claw" } replace tail VERY { cb_puts "moderately " } output add tiger NAME { cb_puts " junior" } replace tail BEGIN { cb_puts "My tail is longer than my dad's.\n" } output cb_delete tiger cb_delete tail