Jump to content

Recommended Posts

Posted

Hi all.

I'm using Task Scheduler to restart my computer at, for example, 12:00am, and then also to run an AutoIt script at 12:05am. The script works when I just run it by manually running the script, and it also works if I run it by manually selecting "Run" from Task Scheduler, but when it runs following the system reboot it does not work. Following the system reboot, the application runs and then the Windows Explorer box (what opens when the Windows key is pressed) opens, and no text is entered anywhere. Can someone help me understand why this is the case and suggest how I can get around it?

```

; Set username and password for autologin here
Local $username = "myUser"
Local $password = "myPass"

; Set app login window ID from AutoIt
; Open Au3Info and go to Window Info -> Window -> Class. Copy/paste the window class and place between "[CLASS:]"
Local $appWindowID = "[CLASS:WindowsForms10.Window.8.app.0.1d2098a_r7_ad1]"

; Set 'target' property in app shortcut properties here
Local $appPath = "C:\app.exe"

; SCRIPT

; Wait 2 seconds before running script
Sleep(2*1000)

; Open app
Run($appPath)

; Get app login window once it opens
$window = WinWaitActive($appWindowID)

; Wait 5 seconds for window to load, then activate it
Sleep(5*1000)
WinActivate($window)

; Click on username field
MouseClick("left", 956, 560)

; Select all and delete
SEND("^a")
SEND("{BACKSPACE}")

; Enter in username
SEND($username)

; TAB to password box
SEND("{TAB}")

; Enter in password
SEND($password)

; Press "ENTER" to log in
SEND("{ENTER}")

```

  • Moderators
Posted

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

  Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Expand  

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Try adding a GUI to the program.
You will find that after Windows starting the GUI it doesn't show up, although you can see your program already running in the TaskManager.
But if you pay attention, it will be run under the system user account, so there is no interaction with the current user's Desktop.

Regards,
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...