Wow! A PMScripter! Rarer than hen's teeth!
Bear with me and I'll see if I have still have copy of the PMScripting bible. It's so long since I looked at iit, I've forgotten what it's called.
Thank you for your efforts. Hansen's book doesn't seem to be available on the web anymore. In this part of the word Pagemaker is still the king for publication layout. It has many features, [importing inline pictures though tags, as an example] that are lacking even in Indesign CS4, so we poor souls have to rely on good old Pagemaker time to time.
From what it seems, reading the documentation, by getpagenumber pagemaker understands current open page in layout view, so the thing I want, that of searching a txt and getting the pagenumber it is in may not be exactly possible.