Jump to content

how to bring a process window to foreground before clicking button


janjo
 Share

Recommended Posts

Hi,

For using on a remote computer, I wrote a script that starts a program so that a 3G internet connection starts. This program comes with the 3G dongle from TP-LINK model MA260.

The script (.exe) is executed by windows Task Scheduler at predefined times.

The 3G connection program is a special one, see attached picture, it's window has no title bar and it starts as a process not an application. The process name is "3GUtility.exe"

Things like:  WinWaitActive(...)    or    WinActivate(...)     do not work.

Everything works, but sometimes there are other windows on the desktop and the window I need to start the connection, by clicking the "Connect" button, gets behind them and so the script clicks in the correct coordinates but on the wrong window.

Please take a look at my script and maybe someone know a solution for this.

In the script I wrote a comment where I would like to make sure the process window is in front of all other before I click the button.

No need to say that before asking here, I've already read many messages and spend many hours trying for a solution but unfortunately without success.

Thank you and best wishes,

Janjos

 

3Gutilitywindow.jpg

autoitstart3G_V2.au3

Link to comment
Share on other sites

  • 2 weeks later...
On 3/8/2020 at 7:31 AM, paw said:

Get the program title and class with Autoit Window Info tool and use that to activate it like
 

$tc = "[TITLE:Mozilla Firefox; CLASS:MozillaWindowClass]"
WinActivate($tc)

Or get the window handle from the PID after starting it
FAQ#How_can_I_get_a_window_handle_when_all_I_have_is_a_PID

He already stated that doesn't work here:
 

 

On 2/24/2020 at 2:30 PM, janjo said:

 

Things like:  WinWaitActive(...)    or    WinActivate(...)     do not work.

 

autoitstart3G_V2.au3 1.82 kB · 10 downloads

 

Link to comment
Share on other sites

I wonder if the application supports command line switches. That may be a simple way to make it work. 

Another option is to see if the connection is a service that is being turned on and off. If yes, that can be done by command line also. Look in your services and see if you can find something to do with tp-link. 

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