Jump to content

after a script is set to run can it remain on hold until a key is pressed rather then a timer delay?


Recommended Posts

Hi I use autoit to automate a lot of my user logins. I made a program in visual basic 6 and for example when I click a button in the program, it automatically launches IE browser and the script is started. I start it with a 10 second delay which gives the page some time to load. Then after 10 seconds the script is active and the tab button automatically gets shifted however many times needed till the curser is in the user name box, for example maybe the tab button was pressed three times (by auto it) . Then a few seconds later the user name is automatically typed in (by auto it). Then there is a 2 second delay then another tab and then another 2 second delay then the password is automatically typed in by auto it. 2 seconds later the enter button is pressed and usually I am successfully logged into whatever site I have it programmed for.

The problem is sometimes a webpage is updated it may for example require an extra tab to be pushed, so since it was programmed to tab 3 times in the example above but now it requires 4 tabs until the curser is in the username box.

So I had an idea to prevent that from happening, if I press the button on VB to launch the webpage and launch the script, is there a way to make the script stay dormant until a button is pressed? That way I can click the curser into the user name field manually and when the curser is there I can press a button on keyboard to activate the script to start running. That way I wont have to worry about the tabs at all

Edited by kq702
Link to comment
Share on other sites

Hi I looked at the help file and I see that I am going to have to learn a lot more about this program before I can learn about how the functions work.

 

So can I cheat and post a copy of my script here and maybe someone can tell me how to quickly change it to require the "z" key to be tapped before the script finishes running? It would be much appreciated

; Script Start - Add your code below here
HotKeySet("x", "MyExit")
Sleep(1000)
send("user01")
Sleep(200)
Send("{tab}")
Sleep(200)
send("passcode01")
Sleep(200)
Send("{enter}")


Func MyExit()
    Exit 
EndFunc

 

Link to comment
Share on other sites

Two ways would be to enter a waiting loop and use _IsPressed to check if a certain key, erm, is pressed :) You can also enter a waiting loop that waits for a boolean variable to be toggled, and use another HotKeySet to toggle that variable.

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