Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 未登录时,AutoIt脚本能否作为计划任务运行?_Ruby_Watir_Autoit - Fatal编程技术网

Ruby 未登录时,AutoIt脚本能否作为计划任务运行?

Ruby 未登录时,AutoIt脚本能否作为计划任务运行?,ruby,watir,autoit,Ruby,Watir,Autoit,我使用Ruby/WATIR/AutoIt通过任务调度程序自动执行任务,只要我登录,任务调度程序就会正常运行,但一旦我的帐户被锁定或注销,脚本就会停止运行 当我重新登录时,AutoIt应该处理文件下载对话框(通过单击保存,然后输入文件名并再次单击保存) 以下代码在我登录时起作用。当我未登录时,AutoIt应该工作吗?是否有其他方法来完成此任务 prompt_message = "Do you want to save this file, or find a program online to o

我使用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", "&Save")
save_fileAlreadyExists = save_dialog.Send("Y")

只有当有人登录并且桌面解锁时,发送击键的AutoIt脚本才会起作用


为了进一步澄清,任何发送击键的程序只有在有人登录且桌面解锁时才能工作。

未登录Windows时,会激活另一个窗口,因此您无法执行任何与窗口相关的操作。但控制命令可能仍然有效