Jump to content

How to run autoit program when certain program drops ?


Recommended Posts

Hey guys so i got a certain code that automates a program basically pushes several buttons on different windows over like 1 minute period of time, but i need only to start this script when certain running program drops. How do i do that ? For now when i execute the autoit scrip it does the job great, but it needs to redo all when certain program with process name drops due to internet disconnect and then the autoit script to start running.

Also one more thing, how do you put condition to proceed only if certain text is displayed in certain coordinates of the program window. Only if that text appears continue, else close and redo all above again ?

thx a lot you've been awesome so far i learned so much from this community :D

Link to comment
Share on other sites

Question 1: you'll have to keep the autoit script running all the time and just wait for that script to drop, then do your magic.

While True ; <-- loop as long as True is true, i.e. loop forever

    While ProcessExists("someProcess.exe")
        Sleep(1000) ; <-- Sleep as long as someProcess.exe exists
    WEnd

    ; The only way we get here is if someProcess.exe does not exist any more.
    ; So, do your button pressing magic here.
    ; If needed, make another sleep loop that runs until a check passes that everything is OK.
    ; Maybe something like this:
    While Not ProcessExists("someProcess.exe")
        Sleep(1000) ; <-- Sleep as long as someProcess.exe does NOT exist, i.e. wait until it does
    WEnd    
    ; In the end, the WEnd below will just make the engine go back to the corresponding While (line 1, in this case).
WEnd

Question 2: depends a lot on how that text is displayed and in what kind of program window. First question: is it a "normal" Windows application GUI (use the AU3Info tool, ctrl+f6 in Scite to find controls to interact with) or does it have its own GUI? If possible, insert a screenshot (block out any privacy information of course).

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

11 hours ago, SadBunny said:

Question 1: you'll have to keep the autoit script running all the time and just wait for that script to drop, then do your magic.

While True ; <-- loop as long as True is true, i.e. loop forever

    While ProcessExists("someProcess.exe")
        Sleep(1000) ; <-- Sleep as long as someProcess.exe exists
    WEnd

    ; The only way we get here is if someProcess.exe does not exist any more.
    ; So, do your button pressing magic here.
    ; If needed, make another sleep loop that runs until a check passes that everything is OK.
    ; Maybe something like this:
    While Not ProcessExists("someProcess.exe")
        Sleep(1000) ; <-- Sleep as long as someProcess.exe does NOT exist, i.e. wait until it does
    WEnd    
    ; In the end, the WEnd below will just make the engine go back to the corresponding While (line 1, in this case).
WEnd

Question 2: depends a lot on how that text is displayed and in what kind of program window. First question: is it a "normal" Windows application GUI (use the AU3Info tool, ctrl+f6 in Scite to find controls to interact with) or does it have its own GUI? If possible, insert a screenshot (block out any privacy information of course).

 

First of all thanks a ton for your reply SadBunny, and no the program is not normal windows application it has its own gui i just need to click a green button to the bottom to connect (see picture). I can go i guess with the gui window coordinates for mouse click, but thing is this is ran on a virtual machine and the mouse is usually on the main pc screen and not on the virtual machine. I saw a guide where a guy clicks buttons without mouse with like button number but does autoit recognize button numbers on custom gui programs that are not windows default ? 

talking about this video guide here, first 1-2 minutes he does that no mouse button clicks:

 

 

purevpn-logiciel.jpg

Link to comment
Share on other sites

As I said, try the AU3Info tool to inspect the windows, if it gives you specific information for controls then you can ControlClick those controls (and do lots of other things to them too).

But getting it to work from a script on the host machine to a window on a guest virtual is probably not going to fly, unless you get it to operate in something resembling VirtualBox's Seamless Mode (AND it has normal Windows controls), then maybe, but I have no experience with that.

That PureVPN window itself looks automatable, by the way, but again you'd probably have to be on the same host to interact with those controls directly.

I would look into putting the autoit script on the client and maybe auto-starting it, or look into configuring the PureVPN connection straight in Windows and do it that way, or maybe create a small server-client combo script on host and guest so you can talk your own protocol back and forth when the guest is running.

There are probably people much more experienced with (trying to) automate processes on guest virtuals who may have better options - I'm just brainstorming here :) Good luck.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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