David A. Black wrote: > Hi -- > > On Fri, 26 Jun 2009, Peter Bailey wrote: > >>>> method, which is an array. >> it does a bunch, then dies. >> C:\Users\pb4072\Documents\scripts\RUBY\multitiffs.rb:8:in `block in >> <main>' >> pages = pages[0][0].to_i >> C:\Users\pb4072\Documents\scripts\RUBY\multitiffs.rb:5:in `each' >> Dir.glob("*.pdf").each do |pdffile| >> C:\Users\pb4072\Documents\scripts\RUBY\multitiffs.rb:5:in `<main>' >> Dir.glob("*.pdf").each do |pdffile| >> >> ============================================= >> Exception: undefined method `[]' for nil:NilClass > > That means that somewhere along the line, the scan operation isn't > finding what you expect it to. Is it possible that you have a document > with more than 99 occurrences of [] in a row? > > I'd still recommend trying the technique I suggested in my earlier > answer. Getting a nested array of one element and unnesting it seems > like the long way around. > > > David But, it does hundreds of files just fine. Then, it dies. So, you're saying that in one file in particular it can find what's in the scan? I'm sorry, but, I don't understand the technique you described earlier, David. You say to do this: pages[/Pages:\D+(\d+),1/] pages = pages.to_i I get "0" as output with this. The output of pdfinfo is simple. Here's an example: Author: pb4072 Creator: Microsoft« Office Word 2007 Producer: Microsoft« Office Word 2007 CreationDate: 09/27/07 13:36:28 ModDate: 02/19/09 14:13:47 Tagged: no Pages: 1 Encrypted: no Page size: 612 x 792 pts (letter) File size: 55418 bytes Optimized: yes PDF version: 1.6 As you can see, there are no [] characters in here. -- Posted via http://www.ruby-forum.com/.