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

  1. if [ catch {set fp [open "$filename" r] } result ] {
  2. puts "error: $result"
  3. } else {
  4. set result ""
  5. while { [catch [gets $fp data] result ] == 0 && $result >= 0 } {
  6. #if {$data eq "file12"} { break }
  7. if { [string match -nocase {*Box*} "$data"] } {
  8. set mediabox 0
  9. regexp {MediaBox\[(.*?)\]} "$data" mediabox
  10. if {$mediabox ne 0} {
  11. puts $mediabox
  12. } else {
  13. regexp {MediaBox \[(.*?)\]} "$data" mediabox
  14. if {$mediabox ne 0} {
  15. puts $mediabox
  16. }
  17. }
  18. set crop 0
  19. regexp {CropBox\[(.*?)\]} "$data" crop
  20. if {$crop ne 0} {
  21. puts $crop
  22. } else {
  23. regexp {CropBox \[(.*?)\]} "$data" crop
  24. if {$crop ne 0} {
  25. puts $crop
  26. }
  27. }
  28. }
  29. }
  30. close $fp
  31. puts "the result $result"
  32. }
  33.  

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.