I have a Word doc which I don't know the page count beforehand.
I have to open the doc to count the page count manually.
The doc is always either 2 or 3 pages in total.
I tried to look for common words to search for and use RegEx, but that was not working.
If the doc is in 2 pages it is almost full of words, about 350 +- words.
If the doc is in 3 pages, the page nb 2 is about 4 -6 words. The whole doc is again about 350 +- words and page 1 and 3 each containing almost half of the words.
if the doc is in 3 pages the page would contain same words 4-6 in totalt:
A city
A park in mars
or
A park in Mars
Rest is empty space until page 3.
But the problem is that these words would be in the last page of Word doc whenever it is 2 pages too.
There must be away to catch page count without COM. I think must of RegEx pros to help me here.
What if something like this could help:
Code: Select all
Clipboard := ""
Send, {Ctrl Down} a {Ctrl Up}
Sleep, 1000
Send, {Ctrl Down} c {Ctrl Up}
ClipWait
MyString := Clipboard
;Regexmatch (MyString xxx, Pagecount)
Msgbox, % Pagecount
return
I would appreciate if anyone could take a look at this when you have time
Other methods than COM are also welcomed? Maybe MS have a hiden way to count page numbers? Google din't make it easy for me