
arkane
Active Members-
Posts
43 -
Joined
-
Last visited
Everything posted by arkane
-
Send() doesnt block anything for me.
-
Last up and I will surrender.
-
Any Idea ?
-
Hi, I wonder if you know how can I do to disable inputs for a targeted windows, I want that my keyboard and mouse doesn't work, but I still want ot be able to send mouse and keyboard clics trough autoit.. That way, I can still use my keyboard or my mouse on any other window. Thanks in advance. I need to set a state, like @SW_DISABLE, but which would still being able to recieve keys sent from my program, and only trough it. Otherwise, if you have any idea about how to bypass the mouse and only it, if it's easier... Edit, maybe by setting a hook, someone can help me to do that ?
-
The behaviour is a lot better like this. there is still a small difference, but it's already very good. Thanks.
-
Okay, but is sleep(0) useful ?
-
Thanks for your interest. So you think I should only use pixel detection ? The fact is, I don't understand when you say "Windows detection".
-
My bot mostly do key presses, to move from an A point to a Z point. I can try to use do/until and use pixel detection, but it will be very hard. But I have a few ideas. Thanks for your advice. I hope there is an another solution ?
-
Hi mates ! First, sorry for my bad english... Okay, my bot is now over and working fine on my computer. But I noticed it wasn't reacting the same way depending of what computer runs it. Keypresses doesn't always last the same time. Here is one exemple : I've a Function like this : Func _sleep($sleeptime) $timer = TimerInit() while TimerDiff($timer) < $sleeptime sleep(10) wend Return 0 EndFunc And I do for exemple : Func ChercherBalle() Send("{s down}{q down}") if _Sleep(3000) = 1 then Return Send("{s up}{q up}") if _Sleep(30) = 1 then Return Send("{z down}{d down}") if _Sleep(1950) = 1 then Return Send("{z up}{d up}") if _Sleep(30) = 1 then Return Send("{z down}") if _Sleep(30) = 1 then Return Send("{z up}") if _Sleep(30) = 1 then Return Send("{z down}") if _Sleep(7700) = 1 then Return Send("{z up}") EndFunc Which works great, I mean, this is the perfect timing for my computer, but not for every computers. Do you have any idea about how I can make it a lot more accurate, so it'll work the same for everybody ? Thanks in advance for your advices ! Someone said me : Isn't it what I'm doing ?
-
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
Can you please give me more informations about how to do that ? I want it to work with the biggest precision possible. -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
It returns 1. But the low level hook seems to work. I'm giving more tries. Ok it works great with low level Keyhook. Thanks a lot to both of you . -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
I don't really know how to check what hotsetkey returns. I mean, hotsetkey works, its role is to say :F1 now runs this function. And not : If you press F1, I'll run this function. So indeed, if I set : if HotKeySet("{F1}", "FocusProg") Then MsgBox(0, "Ok !", "Works...") Else MsgBox(0, "... !", "Doesn't work...") EndIf Once the gui appears, I'm spammed of "Works..." Msgbox (my hotsetkey function is in a while loop). I suppose I havn't understood what you exactly meant. @KaFu : I don't understand how to use it, even with an exemple. I guess I'm not skilled enough to use hooks. But I'm pretty sure that it is what I need, so I can detect "F1 key is pressed" at any time. Edit : I've managed to adapt an exemple I found in the help file. I guess it needs some more modifications. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hHook, $hStub_KeyProc, $buffer = "" _Main() Func _Main() OnAutoItExitRegister("Cleanup") Local $hmod $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") $hmod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) While 1 Sleep(10) WEnd EndFunc Func EvaluateKey($keycode) If ($keycode = 112) then ;F1 $buffer &= Chr($keycode) Send("TEST") Else $buffer = "" EndIf EndFunc ;=========================================================== ; callback function ;=========================================================== Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Then EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode")) EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc Func Cleanup() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_KeyProc) EndFunc -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
I still don't understand why... Might someone help me ? -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
Anyone ? -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
Edit : I was wrong. It works. But in fact, my GUI needs to have the focus : my WinActivate in FocusProg() doesn't seems to work correctly. It works if everything but my game got the focus... no matter what Key I choose. Do you have any idea why ? Edit 2 : Note that the issue seems to come from Hotsetkey, which isn't reacting if my game got the focus. I replaced HotKeySet("{F1}", "FocusProg") by if _IsPressed("70", $dll) then FocusProg() And it works from the game. But unfortunalty, I can't use _isPressed, because unlike Hotsetkey, it doesn't have priority over an another function. So maybe you have an idea about how to give it priority, or maybe you know how to make hotsetkey react trough my game . Thanks in advance. -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
I tried with a messagebox. It doesn't work. It's not called once I launched the script. I use : F5 to launch one script, using _isPressed, F6 for an another. While sleep(10) ;F5 if _IsPressed("74", $dll) then ActiverMaster() endif ;F6 if _IsPressed("75", $dll) then ActiverJoueur() endif HotKeySet("{F1}", "FocusProg") WEnd DllClose($dll) ... Func FocusProg() WinActivate($bot) ControlFocus($bot, "", "[CLASS:Button; INSTANCE:4]") ControlClick($bot, "", "[CLASS:Button; INSTANCE:4]") MsgBox(0,"hi","It's working") EndFunc Once I press F5 or F6, the script go into the called function. So I can't press f5 or f6 one more time unless I press stop, which is normal. But HotKeySet is supposed to interrupt everything and have priority, that's what is written in the help file. The issue is not with f1. I did try F5 too, which work with isPressed, but it doesn't. -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
GUISetAccelerator() doesn't work if it hasn't the focus. Hotsetkey neighter. I tried : HotKeySet("{F1}", "FocusProg") ... Func FocusProg() WinActivate($bot) ControlFocus($bot, "", "[CLASS:Button; INSTANCE:4]") ControlClick($bot, "", "[CLASS:Button; INSTANCE:4]") EndFunc But it doesn't work once the script has started (manual click still works indeed). $bot is the title of the window of my program. -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
It's definitely working great. I addapted the whole thing to my 400 lines code... Took a while but worth it ! I need a last help, and then I'll be done . Do you know how can I do to activate a button with a key ? I mean, I would like for example to set F1, to stop the script. I tried the ControlClick function, which works, but not when the script is launched so it's useless. Do you have any clue ? Thanks again. -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
Bah, In fact, for what I want to do, you have to hold down a key : Pressing z twice, but holding the second press will make a character run faster. And it finally seems to work, I probably did a mistake somewhere while trying to understand it . -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
So it means that milliseconds arn't the same for everybody ? Anyway to make this work a little better ? Maybe by increasing the sendkeydown delay ? Edit : Btw, I found a small issue to your correction. When you press "stop" , you can't launch the script anymore. -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
Thanks a lot KaFu ! I'm not understanding everything in your correction, but I'm taking a deep look in it. Thanks again. Let my ask you something else please : Do you know why when I do : Send("{z down}") if _Sleep(7400) = 1 then Return Send("{z up}") It doesn't really work the same for everybody ? I mean, let's imagine that Z key makes a character walk forward. So you start from an "A" point, and wants to reach a "Z" point" by pressing Z for 7,4 seconds. Do you know why for some people, it will make the character go further ? -
[Solved, Thx] Start / Stop button, and a loop
arkane replied to arkane's topic in AutoIt General Help and Support
Thanks for you answer. I did try the following : #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("SendKeyDownDelay", 25) Opt("MouseClickDownDelay", 50) $BotFenetre = GUICreate(".: Test 2 :.", 300, 325, 0, 0, -1, $WS_EX_TOPMOST) $Start = GUICtrlCreateButton("Start", 80, 280, 50, 20) GUICtrlSetOnEvent($Start, "ActiverJoueur") $Stop = GUICtrlCreateButton("Stop", 160, 280, 50, 20) GUICtrlSetOnEvent($Stop, "Quitter") GUISetOnEvent($GUI_EVENT_CLOSE, "Quitter") GUISetState(@SW_SHOW) AdlibRegister ("checkstop") Func checkstop() $msg = GUIGetMsg(1) Select Case $msg[0] = $Stop ExitLoop EndSelect EndFunc While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $BotFenetre Then GUISwitch($BotFenetre) GUIDelete() Exit EndIf Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $BotFenetre Then GUISwitch($BotFenetre) GUIDelete() Exit EndIf Case $msg[0] = $Start ActiverJoueur() EndSelect WEnd Func Quitter() GUIDelete() AdlibUnRegister("checkstop") Exit EndFunc Func TuerPorteur() ;~ On sprint Send("{z down}") sleep(30) Send("{z up}") sleep(30) Send("{z down}") sleep(7400) Send("{z up}") ;~ On tue Send("{q down}") sleep(150) Send("{q up}") MouseDown("left") sleep(4000) MouseUp("left") EndFunc Func ActiverJoueur() While 1 ;~ On se met pret MouseClick("left", 636, 896, 1, 0) sleep(2500) ;~ On va tuer le porteur TuerPorteur() WEnd EndFunc But it returns me this error : ""ExitLoop/ContinueLoop" statements only valid from inside a For/Do/While loop" Edit : I also tried to put my checkstop function into a while 1 loop, then it launchs, but the stop button still doesn't work. -
Hi, I've posted a similar topic in an another section, but I guess it wasn't the best one to talk in. So I prefer repost it here. My problem is that, I've created 2 buttons. One start, one stop. When I clic start, it's supposed to execute a few functions, but when I hit Stop, I want it to act as an "ExitLoop". My issue is that in one of my functions, there are many loops, like do-untile, while 1... Here is a minimal exemple I made so you can see what I'm talking about : #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("SendKeyDownDelay", 25) Opt("MouseClickDownDelay", 50) $BotFenetre = GUICreate(".: Test 2 :.", 300, 325, 0, 0, -1, $WS_EX_TOPMOST) $Start = GUICtrlCreateButton("Start", 80, 280, 50, 20) GUICtrlSetOnEvent($Start, "ActiverJoueur") $Stop = GUICtrlCreateButton("Stop", 160, 280, 50, 20) GUICtrlSetOnEvent($Stop, "Quitter") GUISetOnEvent($GUI_EVENT_CLOSE, "Quitter") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $BotFenetre Then GUISwitch($BotFenetre) GUIDelete() Exit EndIf Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $BotFenetre Then GUISwitch($BotFenetre) GUIDelete() Exit EndIf Case $msg[0] = $Start ActiverJoueur() EndSelect WEnd Func Quitter() GUIDelete() Exit EndFunc Func TuerPorteur() ;~ On sprint Send("{z down}") sleep(30) Send("{z up}") sleep(30) Send("{z down}") sleep(7400) Send("{z up}") ;~ On tue Send("{q down}") sleep(150) Send("{q up}") MouseDown("left") sleep(4000) MouseUp("left") EndFunc Func ActiverJoueur() While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $Stop ExitLoop EndSelect ;~ On se met pret MouseClick("left", 636, 896, 1, 0) sleep(2500) ;~ On va tuer le porteur TuerPorteur() WEnd EndFunc I need that button to stop my code, no matter where I actualy am in the evolving of my code, which function I'm executing. Do you have any idea ? Sorry for my english btw. Enjoy, and happy 2010 .
-
Please, if you think this thread hasn't its place here, just put it in an another section .
-
Arf, it seems no one knows ? I also tried the onevent mode, it doesn't work better. It doesn't want to cancel loop, as it's written in the help : #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("SendKeyDownDelay", 25) Opt("MouseClickDownDelay", 50) $BotFenetre = GUICreate(".: Test 2 :.", 300, 325, 0, 0, -1, $WS_EX_TOPMOST) $Start = GUICtrlCreateButton("Start", 80, 280, 50, 20) GUICtrlSetOnEvent($Start, "ActiverJoueur") $Stop = GUICtrlCreateButton("Stop", 160, 280, 50, 20) GUICtrlSetOnEvent($Stop, "Quitter") GUISetOnEvent($GUI_EVENT_CLOSE, "Quitter") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $BotFenetre Then GUISwitch($BotFenetre) GUIDelete() Exit EndIf Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $BotFenetre Then GUISwitch($BotFenetre) GUIDelete() Exit EndIf Case $msg[0] = $Start TailleS4() ActiverJoueur() EndSelect WEnd Func TailleS4() global $RatioX, $RatioY, $size If ProcessExists("S4Client.exe") Then $Size = WinGetClientSize("S4 Client") $RatioX = $size[0]/1280 $RatioY = $size[1]/1024 Return $RatioX & $RatioY Else MsgBox(262144, "Boulet mon ami, mon ami boulet !", "Veuillez lancer S4 league avant de lancer ce bot.") GUIDelete() Exit EndIf Endfunc Func Quitter() GUIDelete() Exit EndFunc Func TuerPorteur() ;~ On sprint Send("{z down}") sleep(30) Send("{z up}") sleep(30) Send("{z down}") sleep(7400) Send("{z up}") ;~ On tue Send("{q down}") sleep(150) Send("{q up}") MouseDown("left") sleep(4000) MouseUp("left") EndFunc Func ActiverJoueur() TailleS4() While 1 ;~ On se met pret MouseClick("left", 636*$RatioX, 896*$RatioY, 1, 0) sleep(2500) ;~ On va tuer le porteur TuerPorteur() ;~ On attends : Partie finie > Lobby > Master..... ;~ do ;~ sleep(25) ;~ Send("{CTRLDOWN}") ;~ sleep(500) ;~ Send("{CTRLUP}") ;~ sleep(500) ;~ PixelSearch( 200*$RatioX, 713*$RatioY, 259*$RatioX,736*$RatioY, 0xFF1ABD,15) ;~ Until @error = 0 ;~ WEnd EndFunc