4

I created an AutoIt script that opens a certain app, and proceeds with a certain behavior. When I compile it, Autoit gives an executable file. If I run it, it works finely and smoothly.

Now: I need it to run sometime during the night, so I added it to the Windows Task Scheduler.

It didn't run.

I decided witnessing the process by changing the execution time, and, whenever it is time to run, sometimes (and ONLY sometimes) the icon pops up in the tray, but anyway nothing happens: no window gets opened and, well, the process does not run.

I have tried changing "run only when user is logged in" and using different user accounts but it doesn't seem to run correctly.

Some search around the Internet tells me that usually these tasks run in background, so no windows are actually opened. Well, then I need to do the opposite of that.

Any help is appreciated.

JD Gamboa
  • 143
  • 1
  • 6
  • It's highly posibble that your script is the culprit of this behavior, Is it a batch? – dmb Jun 01 '18 at 00:56
  • @dmb, No, sir. It is an AutoIt generated .exe file. – JD Gamboa Jun 01 '18 at 15:19
  • 1
    Then you need to check your settings in TaskScheduler. In the propertiy menu for the taks, check "Run with highiest privileges", check "Execute wether the user is not loged in" and give it the password, unchek "Hidden". Set a trigger in Triggers. Give a quick look to conditions. On Configuration allow to "Execute on demand". Lastly I'd sugest to execute your AutoIt from a batch to log errors with `C:\path\to\AutoIt.exe > errorlog.txt 2>&1` – dmb Jun 01 '18 at 15:34
  • @PimpJuiceIT I have tried your first answer (the one refering the images) and it seems to work. I had previously tried checking "run with highest privileges", so I assume the "start in" made a significant difference. Please DO post it as an answer to qualify it as such. I haven't attempted your second answer or dmb latest one, but I believe they will serve well to other people. – JD Gamboa Jun 01 '18 at 16:38

2 Answers2

1

I actually run a compiled AutoIT script via Task Scheduler that does something similar as you describe and the only settings needed in Task Scheduler are:

  1. From the General tab check Run only when use is logged on and Run with highest privileges. The account that you use to run the job that executes the executable file will need to have permission to execute the file where it resides. To test these permissions are not a problem, just log in as that user, and then double-click on the executable file and confirm that you have permission to run it that way.

    i.imgur.com/rdCry0f.png

  2. From the Edit Action area be sure the Program/script field points to the full explicit path where the executable file resides. Also be sure the Start in field has the full path where the executable file resides with just the path only though. As long as you have this set as well as confirming the user running the process has permission to do so, then it should run as expected.

    i.imgur.com/k8c1QLy.png.


Further Resources

  • Check "some" of the detail on "Windows 10: Scheduled tasks with workstation lock/unlock not being triggered" in case any of this is applicable and you wish to double check for the applicable options only.

  • If you still have trouble, then it may be beneficial to see the AutoIT logic you are using to further troublshoot. The icon showing up in the task bar but not taking some action implies an AutoIT level issue potentially but when it does not pop up in that area at all, this would indicate a Task Scheduler level issue I believe.

Vomit IT - Chunky Mess Style
  • 40,038
  • 27
  • 84
  • 117
0

I was facing this same problem, that when .exe were ran via task scheduler, some of the functions were failing (not all), but after defining my file path in that "Start in (optional)" -text field, all started to work out.

Thank you.

Robot
  • 1