Question

Close all browser window except AA Control room

  • 8 January 2023
  • 7 replies
  • 504 views

Badge +5

Hi All,

           I don't have a runner machine assigned so I am using the creator machine for testing. My requirement is to close all browsers window except the AA control room window before the bot execution. Close all action closes all windows including the AA control room window . Kindly suggest an alternative.


7 replies

Userlevel 5
Badge +10

@Sai Deepan.R  use below script 

#NoEnvSendMode InputSetWorkingDir %A_ScriptDir%^q::    WinGet, WindowList , List , ahk_class IEFrame    Loop %WindowList%        {        WinID := WindowList%A_Index%        WinGetTitle Title , ahk_id %WinID%        if ( not InStr( Title , "Google" ) )            WinClose , ahk_id %WinID%        }Return

 

FYI : check this article - https://www.autohotkey.com/board/topic/69513-loop-through-all-browser-windows-and-close-all-except-one/

Badge +5

@rbkadiyam  Thanks for the reply and info. I am having trouble executing this.

  1. Do I need to use JavaScript action to execute the code. I also did try vbscript .Please refer to the screenshot below.
  2.  As per the code I believe we are trying to close all the windows except window title “Google” . In my case the window title is  “Master bot for …...” and should not closed . Can I use “%Master%” ?
Badge +5

Looking for recommendation to handle this!!

Userlevel 5
Badge +9

Looking for recommendation to handle this!!

I think the first step is get the windows names. I saw some scripts  without success but i still dont have a progress with this question.

Userlevel 5
Badge +10

@Sai Deepan.R 

As per the code I believe we are trying to close all the windows except window title “Google” . In my case the window title is  “Master bot for …...” and should not closed . Can I use “%Master%” ?

 

Yes, you  have to provide the title of the browser which wanted to alive…..  “ Master * “

 

 if ( not InStr( Title , "Master *" ) )   
Userlevel 5
Badge +10

@Sai Deepan.R  other way to do this within AA

Logic

  1. Start
  2. Loop 
  3. Open Browser Window
  4. Act (Record/Capture)
  5. Assign currently active window to a window variable and check if condition 
  6. Close the window if active window value does not match 
Badge +5

@rbkadiyam  Thanks again for the reply. Before my step execution I need to close all the active windows except one window. With your solution I believe you are opening all the windows and then closing it(Step 3). Is there a way to get the list of all open windows ?

Reply