我有一个脚本会自动填充Bluebeam PDF中所有文本框的操作。请记住,我刚刚开始使用AutoIT。 以下是供参考的代码:
#region --- Au3Recorder generated code Start (v3.3.9.5
KeyboardLayout=00000409) ---
Global $textBoxNumber = InputBox("Text box number", "Enter the number of text
boxes. (three character max)", "", " M3")
Global $textBoxCounter = 1
Global $downVariable = ''
Global $documentName = InputBox("Document Name", "Enter the document name.", "", " M50")
#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
If $aResult[1] <> '00000409' Then
MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')')
EndIf
EndFunc
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
#include <String.au3>
_AU3RecordSetup()
Do
_WinWaitActivate($documentName,"")
MouseClick("left",1785,822,1)
_WinWaitActivate("Action","")
MouseClick("left",72,55,1)
MouseClick("left",521,103,1)
_WinWaitActivate("JavaScript Editor","")
MouseClick("left",269,125,1)
Send("var txtField = event.target{ENTER}txtField.fillColor = color.yellow;")
MouseClick("left",331,248,1)
_WinWaitActivate("Action","")
MouseClick("left",516,410,1)
_WinWaitActivate($documentName,"")
MouseMove(1792,795)
MouseDown("left")
MouseMove(1788,796)
MouseUp("left")
MouseClick("left",1748,873,1)
MouseClick("left",1759,820,1)
_WinWaitActivate("Action","")
MouseClick("left",75,51,1)
MouseClick("left",469,95,1)
_WinWaitActivate("JavaScript Editor","")
MouseClick("left",222,84,1)
Send("var txtField = event.target{ENTER}txtField.fillColor =
color.transparent;")
MouseMove(320,253)
MouseDown("left")
MouseMove(320,252)
MouseUp("left")
_WinWaitActivate("Action","")
MouseClick("left",497,403,1)
_WinWaitActivate($documentName,"")
MouseClick("left",232,995,2)
MouseClick("left",232,995,2)
MouseClick("left",232,995,2)
MouseClick("left",232,995,2)
MouseClick("left",232,995,2)
MouseClick("left",232,995,2)
MouseClick("left",232,995,1)
MouseMove(234,995)
MouseDown("left")
MouseMove(233,222)
MouseUp("left")
MouseClick("left",69,225,1)
$textBoxCounter += 1
$downVariable = _StringRepeat("{DOWN}", $textBoxCounter)
Send($downVariable)
Until $textBoxCounter = $textBoxNumber + 1
#endregion --- Au3Recorder generated code End ---
我已经使用它超过2个月了,当我坐下来时,我几乎为我工作,更聪明地工作。突然间,当我昨天使用它时,它到了第10个文本框并退出我,点击随机空间,暂停脚本。我已多次尝试过,甚至重写代码,但每次都会出现这个错误。
为什么会这样?