Jump to content

arkane

Active Members
  • Posts

    43
  • Joined

  • Last visited

arkane's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Send() doesnt block anything for me.
  2. Last up and I will surrender.
  3. 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 ?
  4. The behaviour is a lot better like this. there is still a small difference, but it's already very good. Thanks.
  5. Okay, but is sleep(0) useful ?
  6. 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".
  7. 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 ?
  8. 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 ?
  9. Can you please give me more informations about how to do that ? I want it to work with the biggest precision possible.
  10. 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 .
  11. 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
  12. I still don't understand why... Might someone help me ?
  13. 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.
×
×
  • Create New...