Can AutoIt scripts run as a scheduled task while not logged in?
Posted
by muddywater
on Stack Overflow
See other posts from Stack Overflow
or by muddywater
Published on 2010-05-09T01:31:54Z
Indexed on
2010/05/09
1:38 UTC
Read the original article
Hit count: 648
I am using Ruby/WATIR/AutoIt to automate a task via Task Scheduler which runs fine as long as I am logged in, but as soon as my account is locked (mandated 10 minute screen lock) or I logout the script stops functioning. When I log back in, it is sitting at the part where AutoIt is supposed to handle a file download dialogue by clicking save and then entering the filename and clicking to save again. The follwing is the code that works while I am logged in. Is AutoIt supposed to work when I am not logged in, and is there some other way to accomplish this?
Thanks!! because search has not turned up anything (terms are too generic)
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")
© Stack Overflow or respective owner