Jump to content

nairada

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by nairada

  1. ;=============================================================================== ; ; Function Name: _MouseClickPlus() ; Version added: 0.1 ; Description: Sends a click to window, not entirely accurate, but works ; minimized. ; Parameter(s): $Window = Title of the window to send click to ; $Button = "left" or "right" mouse button ; $X = X coordinate ; $Y = Y coordinate ; $Clicks = Number of clicks to send ; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs. ; Author(s): Insolence <insolence_9@yahoo.com> ; ;=============================================================================== Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1) Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local $MK_RBUTTON = 0x0002 Local $WM_RBUTTONDOWN = 0x0204 Local $WM_RBUTTONUP = 0x0205 Local $WM_MOUSEMOVE = 0x0200 Local $i = 0 Select Case $Button = "left" $Button = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case $Button = "right" $Button = $MK_RBUTTON $ButtonDown = $WM_RBUTTONDOWN $ButtonUp = $WM_RBUTTONUP EndSelect If $X = "" OR $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf For $i = 1 to $Clicks DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $WM_MOUSEMOVE, _ "int", 0, _ "long", _MakeLong($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $ButtonDown, _ "int", $Button, _ "long", _MakeLong($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $ButtonUp, _ "int", $Button, _ "long", _MakeLong($X, $Y)) Next EndFunc Func _MakeLong($LoWord,$HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc Have you seen/tried this before?
  2. #include <GUIConstants.au3> $GUI = GUICreate("", 161, 37, -1, -1) $Input = GUICtrlCreateInput("Type hello then hit enter!", 8, 8, 145, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Input If GuiCtrlRead($Input) = "Hello" Then MsgBox(4096, "Hello!", "You pressed the enter key!") EndIf EndSwitch WEnd Modified NeoTroniX's example. Is this more like what you want?
  3. Thanks for your help Toady and danwilli. Initially, I wanted a method that I am no longer interested in. What I plan to do is to create multiple boxes for the script to scan. It will initially do a PixelChecksum in each box, then it will scan each one for changes. I had begun working on it when Toady posted his suggestion, and I realized that this would be the way to go. However, I need a bit more help working with arrays. I've never used them in AutoIt before, and as such am unexperienced. Toady, could you please give me an example of the method that you were talking about?
  4. I thought about doing this, but it's not exactly the approach that I was looking for. See, I'm trying to make a bot for this game, so that I'm more familiar with them. Then, using the knowledge I have, I'm going to make a bot for another game where there aren't fixed locations where "moles" will come out of. Instead of having these fixed holes, the "moles" will randomly be generated at different locations all over the screen. That's why I was trying to find the "fix" that I described in the first post. Thanks for your help, though.
  5. Hello, I'm trying to make a simple AutoIt bot for a Whack A Mole styled game. If you're not familiar with this sort of game, I'll explain: There are holes in the ground where the Moles will come out of. Each time it will come out of a random new hole, and what you're supposed to do is click on the mole, and this will gain points. What I'm trying to do is scan the game while waiting for a change to occur. For this game, that change would be the mole popping out. Once it has detected a change, I'd like to know the coordinates for the change, so I can then have the bot click where the change occurred. Normally, I would use the PixelSearch function, and search for a pixel that's only common to each mole.. that is not a possibility because each time a mole comes out, it has a random color applied to it. Also, I understand that I could use PixelChecksum to discover if a change has occurred, however, I'm not sure of how this could give me the exact location of where this change has occurred. If anyone knows how I could go about doing this, please let me know.
  6. i had a problem with then when i was writing autohotkey programs to work in-game. basically, the keys weren't being held down, and i'd have to put SetKeyDelay 75,75 but, i've not got enough experience with autoit to make it work in-game. sorry
  7. is this possible? and if so, can the coordinates of the text be saved?
  8. Global $Paused HotKeySet("{END}", "TogglePause") HotKeySet("{HOME}", "Terminate") While 1 Sleep(100) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) Send("{Enter}") WEnd EndFunc Func Terminate() Exit 0 EndFunc Hit End to start sending enter, home to close the program. something along those lines what you are looking for?
×
×
  • Create New...