我有一个AutoIT脚本可以通过鼠标操作打开并滚动到PDF文件的结尾。滚动的次数取决于缩放百分比和页数。如何确定PDF文件的结尾以配置滚动的次数? 下面是示例脚本。我修改了滚动的次数是15
Func OpenAllPDFFile($vardirectory)
If @error = 1 Then
MsgBox($MB_SYSTEMMODAL, "", "Path is invalid.", 2)
ElseIf @error = 4 Then
MsgBox($MB_SYSTEMMODAL, "", "No report(s) found.", 2)
ElseIf @error Then
MsgBox($MB_SYSTEMMODAL, "", "Fail to open report", 2)
Else
$FileArray = _FileListToArray($vardirectory, "*.pdf",1)
$NewFileArray = SortPDFFile($FileArray)
For $i = 0 To UBound($NewFileArray)-1
ShellExecute($vardirectory & "\" & $NewFileArray[$i])
ConsoleWrite("Opening pdf file: " & $NewFileArray[$i] & @CRLF)
if WinWaitActive($NewFileArray[$i]) Then
ConsoleWrite("Pdf file " & $NewFileArray[$i] & " is opened" & @CRLF)
WinSetState($NewFileArray[$i], "", @SW_MAXIMIZE)
Sleep($varSleep)
ControlClick($NewFileArray[$i], "", $varZoomPercent)
ControlSend($NewFileArray[$i], "", $varZoomPercent, $vPercent)
Send("{ENTER}")
Sleep($varSleep)
For $y = 0 To 15
If WinExists("[CLASS:AcrobatSDIWindow]") Then
MouseWheel($MOUSE_WHEEL_DOWN, 12)
Sleep($varSleepRead)
Else
ExitLoop
EndIf
Next
Else
ConsoleWrite("Could not find pdf file: " & @CRLF)
EndIf
WinClose("[CLASS:AcrobatSDIWindow]")
Next
EndIf
WinClose($varDUTPlot,"")
EndFunc
答案 0 :(得分:0)
如果你真的需要转到PDF的末尾,我会像这样使用Page Down:
data-...
您可以通过编辑睡眠时间(以毫秒为单位)来增加或减少时间。
我不知道如何使用PDF尺寸进行缩放。
如果您知道页面数量,那将很容易。 ;)
Send("{PGDN down}") # hold key down
Sleep(10000) # hold it for 10 sec
Send("{PGDN up}") # stop holding it