Posted to tcl by rhobart at Thu Nov 23 00:08:32 GMT 2023view pretty

if [ catch {set fp [open "$filename" r] } result ] {
		puts "error: $result"
	} else {
		set result ""
		while { [catch [gets $fp data] result ] == 0 && $result >= 0 } {
			#if {$data eq "file12"} { break }
			if { [string match -nocase {*Box*} "$data"] } {
				set mediabox 0
				regexp {MediaBox\[(.*?)\]} "$data" mediabox
				if {$mediabox ne 0} {
					puts $mediabox
				} else {
					regexp {MediaBox \[(.*?)\]} "$data" mediabox
					if {$mediabox ne 0} {
						puts $mediabox
					}
				}
				set crop 0
				regexp {CropBox\[(.*?)\]} "$data" crop
				if {$crop ne 0} {
					puts $crop
				} else {
					regexp {CropBox \[(.*?)\]} "$data" crop
					if {$crop ne 0} {
						puts $crop
					}
				}
			}
		}
		close $fp
		puts "the result $result"
	}
	

Comments

Posted by Hobart at Thu Nov 23 00:29:48 GMT 2023 [text] [code]

while { [catch {gets $fp data} result ] == 0 && $result >= 0 } { I change to what you sent me the first time. Thank you for your help. I looked so much at the code that I could not see straight.