Jump to content

Problem with Pause


VixinG
 Share

Recommended Posts

Hi, I am new to autoit and I searched about my problem but couldn't find.

I'm currently writing a "bot" more like a helper, which is running the program, writing username and password then clicking the login button.

The problem is, that when bot is typing the password, he's Pausing and I don't know why. I need to click "P" to unpause and everything later is fine.

Here's my code, hope you will help me solve my problem (it's wrote super simple):

Func Stars()
$result = _ImageSearch("star.bmp", 1, $x, $y, 10)
If $result = 1 Then
MouseClick("LEFT",$x,$y,1,0)
Send("^a")
Sleep("500")
Send("{BS}")
Sleep(100)
Send($password)
Else
$result = _ImageSearch("star2.bmp", 1, $x, $y, 10)
If $result = 1 Then
  MouseClick("LEFT",$x,$y,1,0)
  Send("^a")
  Sleep("500")
  Send("{BS}")
  Sleep(100)
  Send($password)
Else
  Send("{TAB}") ;Jump to password's box
  Send("^a")
  Sleep("500")
  Send("{BS}")
  Sleep(100)
  Send($password) ;Password from txt file
EndIf
EndIf
EndFunc

That's code just for password, Login is fine and all previous is fine too, because it stops just on this part.

Here's Pause function:

Func TogglePause()
  $Paused = NOT $Paused
    While $Paused
      sleep(100)
      TrayTip("Bot is Paused!","P = Resume"&@CRLF&"ESC = Exit",30,1)
  WEnd
  TrayTip("clear","",0)
EndFunc

And it's like:

ProgramRun()
SkipVerCheck()
Login()
Stars()
LoginButton()

/edit: When I delete the TogglePause function, everything is running just fine without errors. I just don't understand... why?

Edited by VixinG

[indent=3][/indent]

Link to comment
Share on other sites

  • Moderators

Hi, vixing, welcome to the forum. Please refer to the forum rules below to see why you will not receive assistance with bots or automating entering credentials.

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yes, I already read that mate.

And I found how to solve this problem - I changed function name and few options and it is working again.

I am not writing a key-log or game bot. It is for AIR application (adobe air, you know). I wanted to add this script to my autostart so I do not need to do everything by myself, it is just easier + I can learn something by creating script like that. I use "ImageSearch.au3" because AutoIt Window Info does not work with AIR and I need to catch images, because there's no "remember me on this computer". Nothing illegal or other stuff.

There's always same sample: "Login" and in password box there is: "*****"...

'star.bmp' is a picture of small star " * " when you enter your password, because I need to mouseclick there and I've got no idea how to do that other way. Anyway I understand the rules and I won't post anything like that anymore if that's bad.

Regards

[indent=3][/indent]

Link to comment
Share on other sites

Thread was reported but it's harmless.

VixinG, if I had to guess based on your incomplete code you are registering a hotkey with HotKeySet() to handle pausing and that hotkey is triggered by Send().

Yes, you are right Valik. I did not know that Send() can trigger the function if the function is HotKeySet()'ed. Thanks a lot for response - I won't do that error in the future :)

[indent=3][/indent]

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