我正在使用Ruby/WATIR/AutoIt通过任务计划程序自动执行任务,只要我登录就可以正常运行,但是当我的帐户被锁定或我注销时,脚本就会停止运行.
当我重新登录时,AutoIt应该处理文件下载对话框(通过单击"保存",然后输入文件名并再次单击"保存").
我登录时以下代码有效.当我没有登录时,AutoIt应该工作吗,还有其他方法可以实现吗?
prompt_message = "Do you want to save this file, or find a program online to open it?"
window_title = "File Download"
save_dialog = WIN32OLE.new("AutoItX3.Control")
sleep 1
save_dialog_obtained = save_dialog.WinWaitActive(window_title,prompt_message, 25)
save_dialog.ControlFocus(window_title, prompt_message, "&Save")
sleep 1
save_dialog.Send("S")
save_dialog.ControlClick(window_title, prompt_message, "&Save")
save_dialog.WinSetTitle(window_title, prompt_message, "This is ForTesting" )
saveas_dialog_obtained = save_dialog.WinWait("Save As", "Save&in", 5)
sleep 1
path = fileName
puts " Edit the file path"
save_dialog.ControlSend("Save As", "", "Edit1",path)
sleep 4
puts " Save the file"
save_dialog.ControlClick("Save As", "Save &in", …Run Code Online (Sandbox Code Playgroud)