RamonBastos Posted December 4, 2009 Share Posted December 4, 2009 Well, My first topic =DI tried to make a macro to a MMORPG that im playing, but looks like it have a protection to keyboard commands. Yea, this is normal, but the curious thing is, its not a 100% protection, i mean, if i leave the macro running, sometimes it "press" they key, sometimes it doesnt..This is my very simple code:$i = 0Sleep(2000)While $i <= 10 Send("{TAB}") Sleep(500) MouseClick("right",156,650) Sleep(6000)WEndThats all i need, but its taking tooo long to press TAB, (if i use it on Notepad, works fine).I tried making a code like that:$i = 0Sleep(2000)While $i <= 10 Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Sleep(500) MouseClick("right",156,650) Sleep(6000)WEndAnd now it "press" TAB more often than the first, but still dont work as i wanted..Any tips? anyway to fix it?Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted December 4, 2009 Developers Share Posted December 4, 2009 More often than every 6 seconds you mean? 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 More sharing options...
skyboy Posted December 4, 2009 Share Posted December 4, 2009 perhaps you should use ControlSend instead, it makes sure that your game is getting the keystroke instead of another program Link to comment Share on other sites More sharing options...
RamonBastos Posted December 4, 2009 Author Share Posted December 4, 2009 No. more often than the first code, but both take longer than six seconds.. ----- To use controlsend i need ClassNN right? i can't get it for my game.. (with the windowspy) Link to comment Share on other sites More sharing options...
Developers Jos Posted December 4, 2009 Developers Share Posted December 4, 2009 No. more often than the first code, but both take longer than six seconds..-----To use controlsend i need ClassNN right? i can't get it for my game.. (with the windowspy)You do know you have a Sleep(6000) in your loop right? 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 More sharing options...
RamonBastos Posted December 4, 2009 Author Share Posted December 4, 2009 You do know you have a Sleep(6000) in your loop right?Yea, after i click, its supposed to wait 6 seconds then press TAB, but sometimes it Click.. Then Click again with no TAB, and sometimes it press TAB twice or more before click. Link to comment Share on other sites More sharing options...
bogQ Posted December 4, 2009 Share Posted December 4, 2009 (edited) Opt("SendKeyDownDelay", 1) ;1 millisecond Opt("MouseClickDownDelay", 10) ;10 milliseconds from help file ? Edited December 4, 2009 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
skyboy Posted December 4, 2009 Share Posted December 4, 2009 (edited) $i = 0 ; setting a variable, insignificant amount of time taken Sleep(2000) ; so far: 2000 While $i <= 10 ; a loop, included times will be multiplied by 11 (0-10, 11) Send("{TAB}") ; can take up to a second since it opens a dll, calls a function, then returns the value and sets an error if needed, so far: 2100 Sleep(500) ; sofar: 2600 MouseClick("right",156,650) ; can take up to a second... etc., so far: 2700 Sleep(6000) ; sofar : 8700 WEnd ; end total: 75700ms; 1m 15s 700ms you will want to reduce it from 6000 to 4000 or 2000 if you really need a delay that long, end time will still be 31900ms, 31s 900ms edit: and your problem is that something else is getting the keystrokes, try ControlSend like i said Edited December 4, 2009 by skyboy Link to comment Share on other sites More sharing options...
RamonBastos Posted December 4, 2009 Author Share Posted December 4, 2009 Opt("SendKeyDownDelay", 1) ;1 millisecond Opt("MouseClickDownDelay", 10) ;10 milliseconds from help file ? Sorry? $i = 0 ; setting a variable, insignificant amount of time taken Sleep(2000) ; so far: 2000 While $i <= 10 ; a loop, included times will be multiplied by 11 (0-10, 11) Send("{TAB}") ; can take up to a second since it opens a dll, calls a function, then returns the value and sets an error if needed, so far: 2100 Sleep(500) ; sofar: 2600 MouseClick("right",156,650) ; can take up to a second... etc., so far: 2700 Sleep(6000) ; sofar : 8700 WEnd ; end total: 75700ms; 1m 15s 700ms you will want to reduce it from 6000 to 4000 or 2000 if you really need a delay that long, end time will still be 31900ms, 31s 900ms edit: and your problem is that something else is getting the keystrokes, try ControlSend like i said Hummmmmm... You mean my loop is taking 1m 15s 700ms? O.O Can you help me with ControlSend? I tried but i can't get it right.. =/ Link to comment Share on other sites More sharing options...
bogQ Posted December 4, 2009 Share Posted December 4, 2009 Sorry?In help file for Opt() func, read coment (Param column) for SendKeyDownDelay TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
skyboy Posted December 4, 2009 Share Posted December 4, 2009 Sends a string of characters to a control. Parameters title The title of the window to access. text The text of the window to access. controlID The control to interact with. See Controls. string String of characters to send to the control. flag [optional] Changes how "keys" is processed: flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow. flag = 1, keys are sent raw. Return Value Success: Returns 1. Failure: Returns 0 if window/control is not found. Remarks ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window. ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages). For normal windows ControlSend should be way more reliable than a normal Send - and yes it does send shift, ctrl, alt etc. As mention in the Send help the keyboard that send different chars when in CAPS LOCK and using the Shift Key cannot be simulated. An example is the Czech Keyboard. A good workaround is to use the ControlSetText. The control might first need to be given focus with the ControlFocus command, specially when referencing an controlID created by the script itself. Opt("SendKeyDelay",...) alters the the length of the brief pause in between sent keystrokes. Opt("SendKeyDownDelay",...) alters the length of time a key is held down before being released during a keystroke. Link to comment Share on other sites More sharing options...
RamonBastos Posted December 4, 2009 Author Share Posted December 4, 2009 ControlSend("Grand Fantasia", "","", "{TAB}") I dont know what to put at "text" and ControlID parameter :S Link to comment Share on other sites More sharing options...
skyboy Posted December 4, 2009 Share Posted December 4, 2009 text is optional, a blank string will match any/no text (i almost always use a blank string); control id has to be the id of the control within the window you're sending it to, if it uses directx or similar for rendering the client area, you won't find a control id (use the autoit window info tool) Link to comment Share on other sites More sharing options...
RamonBastos Posted December 4, 2009 Author Share Posted December 4, 2009 Hummm, i guess there isnt a control ID then?Any other way to bypass it? Link to comment Share on other sites More sharing options...
bogQ Posted December 4, 2009 Share Posted December 4, 2009 from help fileSendKeepActive Attempts to keep a specified window active during Send(). (thisone is becose if anyone suspect that something else is getting the keystrokes)there is alsoWinActivate("")WinWaitActive("")If WinActive("winname") Then send()and whall text from the help file for SendKeyDownDelayAlters the length of time a key is held down before being released during a keystroke. For applications that take a while to register keypresses (and many games) you may need to raise this value from the default. A value of 0 removes the delay completely.Time in milliseconds to pause (default=5).If you rly determanded to try ControlSend() try with no ID to see if itl workControlSend("Grand Fantasia", "","", "{TAB}")Thats from me for this post, gn all TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
RamonBastos Posted December 5, 2009 Author Share Posted December 5, 2009 from help fileSendKeepActive Attempts to keep a specified window active during Send(). (thisone is becose if anyone suspect that something else is getting the keystrokes)there is alsoWinActivate("")WinWaitActive("")If WinActive("winname") Then send()and whall text from the help file for SendKeyDownDelayIf you rly determanded to try ControlSend() try with no ID to see if itl workThats from me for this post, gn all THanks for the help =DBut i tried all what u said..Tried SendKeepActive, tried If WinActive("winname") Then send(), tried to change the delay..nothing worked =/, it still pressing TAB whenever he wants.. weird =/ Link to comment Share on other sites More sharing options...
bustasnipe Posted January 7, 2010 Share Posted January 7, 2010 Run autoit and the game as administrator and it should send() keys just fine, however you will not be able to use controlsend() to send keys to your quickbar to activate skills. If anyone knows how to activate skills in this game while the game window is minimized..please enlighten me. I have tried controlsend, postmessage/sendmessage.. I can send keys to the login screen and chatbox while ingame if i press enter and bring up the chatbox, but other then that the keys are not acknowledged. Link to comment Share on other sites More sharing options...
omikron48 Posted January 7, 2010 Share Posted January 7, 2010 If the problem is that the key presses or mouse clicks don't register in the game, it may be a matter of the input happening too quickly for the game to recognize it. This can be fixed by making the input delays longer for key presses and mouse clicks. Same thing happened to a game (vertical shooter) I tried making a turbo fire button for. My initial attempt worked for the first few seconds then the craft no longer fired anything. My script worked correctly after lengthening my key press delay to 50ms. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now