Jump to content

Taskbar Flash Problems when Running AutoIT Exe with Task Scheduler


 Share

Recommended Posts

What I'm trying to do:

Build an autoit .exe that will run via the windows task scheduler on login and every x minutes that will do the following:

Open a windows shortcut, press enter to login the user; Also, if the active window is no longer the windows that was opened by the shortcut, close all windows and reopen the shortcut and login.

The functionality almost works; The issue is that on subsequent openings of the shortcut after the window has been closed or is not active, after the script executes the ShellExecute function, the windows taskbar flashes. This takes focus away from the opened window so that the Send(Enter) function cannot login the user. Of course also the task bar appears and blocks the bottom of the open window. Screenshot and script attached. I've tried various win functions like winactivate and winsetstate with no avail. Any advice would be appreciated.

AutoIt v3

Windows 7 Professional

Thanks,

fsDrew

 

Local $Active = winactive("Display")

If $Active = 0 Then
         ; Retrieve a list of window handles.
            Local $aList = WinList()
            ; Loop through the array displaying only visable windows with a title.
            For $i = 1 To $aList[0][0]
               If $aList[$i][0]   And BitAND(WinGetState($aList[$i][1]), 2) Then
                  WinKill($aList[$i][0])
               EndIf
            Next
      ShellExecute("C:\Display.lnk")
      Sleep(1000)
      WinActivate("Display")
      Sleep(2000)
      Send({ENTER})
EndIf

 

Untitled.png

Link to comment
Share on other sites

Solved...The window title to activate is different then to check if active. I used the console write function and the For Loop function in the existing code to write all the active window titles. When I used the windows title that was written to the console it worked as expected.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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