# # Copyright 2006 (c) Pointwise, Inc. # All rights reserved. # # This sample Gridgen script is not supported by Pointwise, Inc. # It is provided freely for demonstration purposes only. # SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE. # ######################################################################## # Removes the given string (presumably the file name) from the # beginning of every database entity's name gg::tkLoad ######################################################################## # Setup the GUI label .title -text "Remove String from Front of DB Entity Name" set font [.title cget -font] .title configure -font [font create -family [font actual $font -family] -weight bold] pack .title -expand 1 -side top set fname "" frame .f1 label .f1.l -text "String:" -anchor w entry .f1.e -textvariable fname -width 24 pack .f1.l -side left -padx 5 -pady 5 pack .f1.e -side left -padx 5 -pady 5 pack .f1 -side top frame .f2 button .f2.b1 -text "OK" -command remove_name button .f2.b2 -text "Cancel" -command exit pack .f2.b1 -side left -padx 5 -pady 5 pack .f2.b2 -side left -padx 5 -pady 5 pack .f2 -side top ######################################################################## proc remove_name {} { global fname set l_fname [string length $fname] if { $l_fname == 0 } { # exit if string is empty exit } else { # set string range set c1 0 set c2 [expr $l_fname - 1] } foreach e [gg::dbGetAll] { set name1 [gg::dbName $e] # test that entity name begins with fname set nameb [string range $name1 $c1 $c2] if { [string compare $fname $nameb] == 0 } { set name2 [string replace $name1 $c1 $c2] # puts "changing $name1 to $name2" gg::dbName $e $name2 } else { # puts "not changing $name1" } } exit } gg::tkLoop # # DISCLAIMER: # TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS # ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED # TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED # BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY # FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES # WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF # BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE # USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN # ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE # FAULT OR NEGLIGENCE OF POINTWISE. #