Jump to content

Need Help with Autoit sending multiple key strokes. - (Locked)


Recommended Posts

So my problem is that if the E key gets pressed more than once the entire action on the focused window ends, requiring me to restart the action. 

For it to work continuously the e key needs to be pressed only once. I've tried different variations of "send" including adding "e down/e up" adding sleep in between using only e by itself without the 1 next to it. It's still spam pressing e.

I removed the focused window name but it's in the actual .exe

 Here's the code

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=D:\Downloads\favicon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
HotKeySet ("{f10}","myExit")

WinActivate("Window")

while(1)
   $cords = PixelSearch(884,902,1920,1080,0x3E60B2,1); Fishing
    if Not(@error) Then
      Send("{e 1}")
   EndIf
WEnd

Func myExit()
   MsgBox(0,"Finished.", "Bot is quitting")
   Exit
   EndFunc

 

The original code was

Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=D:\Downloads\favicon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
HotKeySet ("{f10}","myExit")
 
WinActivate("window")
 
while(1)
   $cords = PixelSearch(0,774,1906,1033,0x0092F8,1); Fishing
    if Not(@error) Then
      Send("{e down}")
      Sleep(250)
      Send("{e up}")
      Sleep(250)
   EndIf
    $cords = PixelSearch(0,774,1906,1033,0x4686A8,1)
    if Not(@error) Then
      Send("{e down}")
      Sleep(250)
      Send("{e up}")
      Sleep(250)
   EndIf
WEnd
 
Func myExit()
   MsgBox(0,"Finished.", "Bot is quitting")
   Exit
   EndFunc

 

Link to comment
Share on other sites

  • Moderators

You have found the limitation of doing it this way. How about explaining in detail what you are trying to accomplish? There is doubtlessly a better way.

"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

I'm trying to automate a fishing mini-game in my GTA server.

When you start fishing, a random popup will show prompting you to press the e button to catch the fish.

The current script catches the fish but then drops the rod.  The fishing min-game make it so that if you press the e button more than once it drops the rod and cancels the mini-game.

 

I was looking through other ways of sending keys and maybe the _WinAPI_Keybd_Event could work but I'm not sure.

Link to comment
Share on other sites

  • Developers

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...