Jump to content

Windows Focus issue


Go to solution Solved by JockoDundee,

Recommended Posts

My Step is simple,

1) Open IE

2) When prompt with "Security Alert", click a specific button

3)  then it will load into another page, prompt for password.

 

The issue is the "Security Prompt" always stays behind, image below. I cannot get it to focus and hence the script hang / stop. But when i click on the security prompt, the script able to continue.

hey guys, will need a simple solution to bring the security prompt box up (instead of IE). Thanks.

 

Capture.thumb.png.d0ddb03aff87f6cf757f16e5c2365ffe.png

Quote

 

#include <IE.au3>

#include <MsgBoxConstants.au3>

Global $oIE = _IECreate("https://hvpn.sg")

 

WinWaitActive ('Security Alert')

WinActivate ('Security Alert')

sleep (200)

ControlClick ("Security Alert","","[CLASS:Button; INSTANCE:1]","Primary")

sleep (20)

WinWaitActive ('Security Alert')

WinActivate ('Security Alert')

ControlClick ("Security Alert","","[CLASS:Button; INSTANCE:1]","Primary")

 

WinActivate ('hvpn.sg - Internet Explorer')

WinWaitActive ('hvpn.sg - Internet Explorer')

sleep (500)

 

 

Link to comment
Share on other sites

2 hours ago, Nine said:

Can you show the au3info.exe tool of that security alert window ?

Yes. 

 

Also to consider Function ControlFocus (autoitscript.com)

For a fast simple button "ok" click I would consider. 

Local $hWnd = WinGetHandle("Security Alert", "")
ControlSend($hWnd, "", "", "{ENTER}")

 


I can't tell what is going on their so idk really.

Link to comment
Share on other sites

I suspect the WinWaitActive lines before WinActivate are the problem (waiting for window to active).

What if you put the WinActivate lines first (before WinWaitActivate)?

 

Also, it seems like the best solution to overcome this would be to add the site as a trusted site in IE; that way you wouldn't even have to worry about the security alert window.  Is that not an option?

Edited by spudw2k
Link to comment
Share on other sites

Thanks for the suggestion. However, this is a work-station and i am not the admin ,therefore unable adjust the setting as it is locked by Admin. This is the only way, to click.

 

Because i amd trying out any difference between swapping the command to which is first, WinActivate / WinWaitActivate, but no luck, issue remains.

On 5/12/2021 at 9:57 AM, spudw2k said:

I suspect the WinWaitActive lines before WinActivate are the problem (waiting for window to active).

What if you put the WinActivate lines first (before WinWaitActivate)?

 

Also, it seems like the best solution to overcome this would be to add the site as a trusted site in IE; that way you wouldn't even have to worry about the security alert window.  Is that not an option?

 

Edited by Peter2004
Link to comment
Share on other sites

This security question is just one part of the whole automation process. I may not have a full admin rights but the process for using the laptop is the same as a user. I have do the same process in order to use the laptop and i believe using Autoit can automate such process by minimize clicks, which increase productivity. And i also believe that the windows focus issue i am having may not be related to the Admin rights.

On 5/14/2021 at 11:09 PM, JockoDundee said:

Why do you think you would be able to automate a security question on a machine which you don’t have full rights on?

 

Link to comment
Share on other sites

  • Solution
1 minute ago, Peter2004 said:

...and i believe using Autoit can automate such process...

Well, it often can.  
However, there are well known limitations in regards to interacting with system tools and prompts when not running with elevated permissions.

For instance, even though a regular user may launch Task Manager and do various things, all interactions cannot be automated when logged in as a regular user, though it can for an authorized user.

 

Code hard, but don’t hard code...

Link to comment
Share on other sites

  • 2 weeks later...

I see. Thanks for the advice on the admin rights.

On 5/17/2021 at 10:00 AM, JockoDundee said:

Well, it often can.  
However, there are well known limitations in regards to interacting with system tools and prompts when not running with elevated permissions.

For instance, even though a regular user may launch Task Manager and do various things, all interactions cannot be automated when logged in as a regular user, though it can for an authorized user.

 

 

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...