Sign in to follow this  
Followers 0
eddie88

Timer / Loop and scroll

2 posts in this topic

Hi All,

I'm trying to write a script that essentialy opens a PDF, scrolls through it until it hits the bottom, and then jumps to the top. That part I can do without a problem. But then, after 30 minutes, I want to close the PDF, copy the latest version of the file, reopen it and continue scrolling through it. I guess this will be done with While...Wend or Do...Until statements (?).

BONUS points if you can help me figure out the following: Can AutoIt figure out how many pages long a PDF is? I was thinking that if each page was a set byte count you may be able to divide the total bytes by that number to get a rough estimate. The point is to keep each page up for about 10 seconds.

I've learned a lot from these forums -- thanks for any help you can offer.

(AutoIt v3)

; Close PDF
ProcessClose("AcroRd32.exe")
; Copy the file from the source to the destination
FileCopy("C:\NewDoc\document.pdf", "C:\OldDoc\", 1)
; Open the PDF
$doc = "C:\OldDoc\document.pdf"
RunWait (@ComSpec & " /c start " & "acrord32.exe " & " " & $doc & "")
; Maximize the window
WinSetState("document.pdf - Adobe Reader", "", @SW_MAXIMIZE)
; Scroll through PDF - default value is 10000
Sleep (10000)
Send ("{PGDN}")
Sleep (10000)
Send ("{PGDN}")
Sleep (10000)
Send ("{HOME}")
; Somehow go back to first "Sleep" and loop this section until 30 minutes have gone by. Then go back up to the first line of the script.
Exit

Share this post


Link to post
Share on other sites



In my version of Adobe acrobat (9.0 full version) the autoit window info tool gives the current page at the very end of the visible text. While this does not give a total page count, it should allow you a work-around to your problem.

When the new number shows up you can start a timer, after 10 seconds page down and check to see if the number changed. If it did, you are on a new page, if not, you are at the end of the document...


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0