Sign in to follow this  
Followers 0
SweatyOgre

Not sending a keystroke

12 posts in this topic

What could be the possible reasons behind AutoIt not sending a keystroke? I need the script to send it once, perform some actions, then send the same one again. Well, it send the keystroke, performs the actions, and doesn't send the keystroke the second time. I have sleep commands before and the keystroke, in case its missing it because its too soon after the actions, so thats not the problem. Any suggestions?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Func PotDrink()
    While $InGameCheck = PixelChecksum (680, 320, 700, 350)
    WinCheck()
  Sleep(100)
    WEnd
    Sleep(500)
    Send("I")
    Sleep(250)
$FCheck = 0
Do
    $FCheck = $FCheck + 1
    $FJuve = PixelSearch(430, 340, 710, 455, 14708848)
  If not @error then
    WinCheck()
    MouseClick("right",$FJuve[0],$FJuve[1], 1, 1)
  Else
  
  EndIf
Until $FCheck = 6;PixelSearch(430, 340, 710, 455, 14708848) = 0
$JCheck = 0
Do  
    $JCheck = $JCheck +1
    $Juve = PixelSearch(430, 340, 710, 455, 10756348)
  If not @error then
    WinCheck()
    MouseClick("right",$Juve[0],$Juve[1], 1, 1)
  Else
  
  EndIf
Until $JCheck = 6;PixelSearch(430, 340, 710, 455, 10756348) =0
$SCheck = 0
Do
    $SCheck = $SCheck + 1
    $SHeal = PixelSearch(430, 340, 710, 455, 12866644)
  If not @error then
    WinCheck()
    MouseClick("right",$SHeal[0],$SHeal[1], 1, 1)
  Else
  
  EndIf
Until $SCheck = 6;PixelSearch(430, 340, 710, 455, 12866644) = 0
$GCheck = 0
Do
    $GCheck = $GCheck + 1
    $GHeal = PixelSearch(430, 340, 710, 455, 15773836)
  If not @error then
    WinCheck()
    MouseClick("right",$GHeal[0],$GHeal[1], 1, 1)
  Else
  
  EndIf
Until $GCheck = 6;PixelSearch(430, 340, 710, 455, 15773836) = 0
$MCheck = 0
Do
    $MCheck = $MCheck + 1
    $SMana = PixelSearch(430, 340, 710, 455, 2384088)
  If not @error then
    WinCheck()
    MouseClick("right",$SMana[0],$SMana[1], 1, 1)
  Else
  
  EndIf
Until $MCheck = 6;PixelSearch(430, 340, 710, 455, 2384088) = 0
$GMCheck = 0
Do
    $GMCheck = $GMCheck + 1
    $GMana = PixelSearch(430, 340, 710, 455, 3158164)
  If not @error then
    WinCheck()
    MouseClick("right",$GMana[0],$GMana[1], 1, 1)
  Else
  
  EndIf
Until $GMCheck = 6;PixelSearch(430, 340, 710, 455, 3158164) = 0
    Sleep($KeyD)
    Send("I")
    Sleep($KeyD)
    WinCheck()  
EndFunc

It doesn't send the second "I".

Edited by SweatyOgre

Share this post


Link to post
Share on other sites

Try

send ("!i")

or

{SHIFTDOWN} Holds the SHIFT key down until {SHIFTUP} is sent

send ("{SHIFTDOWN}")

send ("i")

send ("{SHIFTUP}")

Rick


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

send ("!i")

+ is shift, alt is !

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

I just need it to send plain "I" key, but in the program it is sending the key, the shift won't affect it, so maybe it will cause the script to send the key.

Share this post


Link to post
Share on other sites

The question is: Wasn't the "I" sent? Or didn't the script reach the line where the second send("I") is placed. I would test it with a simple Output. Just put a MsgBox(0, "Output", "Line has been reached") instead of the second send ("I") and look it comes up or not. Or just write something to a textfile.

arctor

Share this post


Link to post
Share on other sites

It's not doing the pixel searches either. I added a MsgBox after the second Send("i") and it is getting to that line...ugh, whats wrong?

Share this post


Link to post
Share on other sites

It's not doing the pixel searches either. I added a MsgBox after the second Send("i") and it is getting to that line...ugh, whats wrong?

I have no more idea. I do not know in what game you are in. I can't test your script on my machine. What I noticed is that a function named WinCheck() is called. But I don't see the function itself.

arctor

Share this post


Link to post
Share on other sites

That function is defined earlier in the script, and is just a simple function to check and see if the game window is active.

Share this post


Link to post
Share on other sites

I just separated the whole function into another script, and ran it, and it worked. AGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHH! Does anyone have any possible idea why autoit wouldn't send a keystroke, or wouldn't perform a pixelsearch?

Share this post


Link to post
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
Sign in to follow this  
Followers 0