Jump to content

winwaitactive to search multiple titles

Recommended Posts

How to use winwaitactive to search for multiple titles at a time.?

Like in my code I am searching for the window with title "Windows Security" and passing credentials automatically.

WinWaitActive("Windows Security")

But there is another window also where I need to pass credentials with title "User Account Control".

How to modify the below code so that it will wait for any of the above windows and send the credentials.


While 1
    WinWaitActive("Windows Security") ;ANy option to keep or condition logic here



Link to post
Share on other sites

This works for me, I am sure there are still many other ways to do it that work just as well.

While 1
    If WinActivate("Windows Security") <> 0 Then ExitLoop
    If WinActivate("User Account Control") <> 0 Then ExitLoop


WinWaitActive("[REGEXPTITLE:Windows Security|User Account Control]")

The main requirement is to pass credentials to UAC prompts and Windows Security prompts coming in Internet explorer and for other apps.

Both the above codes(provided by Exit and ViciousXUSMC) are working for WIndows Security and any window with name (i.e,created a txt file with the below name and when we open that txt file as the window name displays as below, it is sending the text)

User Account Control

But with original UAC prompts it is not working.

The reason I found out for this is that when UAC is activated it is blocking complete screen for not taking any input and only activates this particular screen until we provide any input.)


Can anyone please help on this.


Link to post
Share on other sites

That is a feature of UAC to block things to prevent malicious attack, and I think its against the forum rules to talk about how to bypass it.  But there is a simple answer, turn it off :)

Yeah I would do it if it is my personal computer :). But I want to use it in domain machine such that whenever this prompt comes I will input my credentials using our program.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By trademaid
      ;WinWaitActive intermittently fails to find the "Exit Session Setting" window.
      ;If the window is moved my the mouse, it will then work.
      ;can anyone help?
      ; this changes the tws logout time to be a minute earlier than the pc clock time
      Opt("TrayAutoPause", 0)
      Opt("MouseCoordMode", 0)
      Opt("WinTitleMatchMode", 2)
      #include <File.au3>
      $logfile = "c:\log\twslogin2" & @YEAR & @MON & @MDAY & ".txt"
      TraySetIcon("Shell32.dll", 180)
      _FileWriteLog($logfile, "Starting")
      ; Live mode
      While 1
          ;If (((@HOUR = 3 And (@MIN > 15 Or @MIN < 31))) Or (@HOUR = 15 And (@MIN > 15 Or @MIN < 31))) Then
          If 1 Then
              ConsoleWrite("tp0 " & @CRLF);
              Opt("SendKeyDelay", 500) ;150
              ConsoleWrite("waiting for jave window " & @HOUR & @MIN & @SEC & @CRLF);
              WinWaitActive("[CLASS:SunAwtFrame]", "")
              ConsoleWrite("found for jave window, waiting for exit window " & @HOUR & @MIN & @SEC & @CRLF);
              _FileWriteLog($logfile, "Exit :Session Setting")
              $ret = WinWaitActive("Exit Session Setting", "", 6)
              ConsoleWrite("tp1 " & @CRLF);
              If ($ret > 0) Then
                  ConsoleWrite("found exit window " & @HOUR & @MIN & @SEC & @CRLF);
                  If WinExists("Exit Session Setting") Then
                      ConsoleWrite("moving windoW " & @HOUR & @MIN & @SEC & @CRLF);
                      WinMove("Exit Session Setting", "", 0, 0, 320, 170, 100)
                      $hr = @HOUR ;
                      If @HOUR > 12 Then
                          Beep(3000, 200);
                          $hr = @HOUR - 12 ;
                      $minutes = @MIN
                      ;If ($minutes > 55) Then $minutes = 20;
                      If ($minutes < 20) Then $minutes = 55;
                      ConsoleWrite("right digit " & @CRLF);
                      MouseClick("left", 126, 60, 1); right most digit
                      Beep(3900, 200);
                      Send("{backspace}" & "{backspace}" & "{backspace}" & "{backspace}" & "{backspace}" & "{backspace}" & "{backspace}" & $hr & ":" & $minutes - 1 & "{enter}");
                      MouseClick("left", 131, 150, 1); update
                      MouseClick("left", 196, 150, 1); close
                      ConsoleWrite("done " & @CRLF);
                      Beep(1500, 20);
                      ConsoleWrite("tp4 " & @CRLF);
                      ;MsgBox($MB_SYSTEMMODAL, "", "Window does not exist", 2)
                      _FileWriteLog($logfile, "Window does not exist")
                      ;Beep(1500, 500);


    • By shmuelw1
      I have a script to open a bunch of programs when I start the computer. I was using WinWaitActive to activate a window then type some text, but it was not working. It could be I was opening too many things at the same time. So I found an alternative to use WinSetOnTop, type the text, then use WinSetOnTop again to make it not be on top anymore.

      Just thought I'd mention that alternative in case it helps someone out there in AutoIt-land.
  • Create New...