eco Posted May 1, 2006 Posted May 1, 2006 doesn't work for me :/, when i launch script it only writes 1 a letter Send("{a down}") Sleep(2000) Send("{a up}")
Simucal Posted May 1, 2006 Posted May 1, 2006 (edited) doesn't work for me :/, when i launch script it only writes 1 a letterSend("{a down}")Sleep(2000)Send("{a up}")EDIT: Listen to herewasplato. Edited May 1, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
herewasplato Posted May 1, 2006 Posted May 1, 2006 Look up AutoItSetOption in the help file.SendKeyDownDelayAlters the length of time a key is held down before 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.Time in milliseconds to pause (default=1). [size="1"][font="Arial"].[u].[/u][/font][/size]
eco Posted May 1, 2006 Author Posted May 1, 2006 (edited) how do i change that delay in script, what to write and where, sorry but this is totally new to me tried this in beginning of script, but didn't help Opt("SendKeyDownDelay", 20) Edited May 1, 2006 by eco
cdkid Posted May 1, 2006 Posted May 1, 2006 Opt("OPTIONNAME","VALUE") at the top of your script ~cdkid PS: Lookup AutoItSetOption in the helpfile AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Don N Posted May 1, 2006 Posted May 1, 2006 Put this line at the top of your script Opt("SendKeyDelay", 5) ;delays for 5 milliseconds or AutoItSetOption( "SendKeyDelay", 5 ) ;delays for 5 milliseconds _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper
Moderators SmOke_N Posted May 1, 2006 Moderators Posted May 1, 2006 (edited) Or you could just make a UDF to do it:_SendDuration('a', 2000) ;Could be like: _SendDuration('a', 2000, 50, 50) if you wanted Func _SendDuration($v_Send, $i_Duration, $i_SendDownDelay = 1, $i_SendKeyDelay = 1) $OptSendDownDelay = Opt('SendKeyDownDelay', $i_SendDownDelay) $OptSendKeyDelay = Opt('SendKeyDelay', $i_SendKeyDelay) Local $SendTimer = TimerInit() Do Send($v_Send) Until TimerDiff($SendTimer) >= $i_Duration Opt('SendKeyDownDelay', $OptSendDownDelay) Opt('SendKeyDelay', $OptSendKeyDelay) EndFunc Edit: Added parameters for sendkeydelay and sendkeydowndelay. Edited May 1, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
eco Posted May 1, 2006 Author Posted May 1, 2006 it doesnt work for some reason , this is my code HotKeySet("{F11}", "start") HotkeySet("{HOME}","end") Opt("SendKeyDelay", 5) While 1 sleep ("100") WEnd Func start() Send("{a down}") Sleep(5000) Send("{a up}") EndFunc Func end() Exit 0 EndFunc
Don N Posted May 1, 2006 Posted May 1, 2006 Have u tried AutoItSetOption() or increasing the delay to a # > 5. Also try the example posted by smoke_n. One of those solutions should work. _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper
eco Posted May 1, 2006 Author Posted May 1, 2006 yes, i tried also AutoItSetOption() and delay to a # > 5 i would try SmOke_N's solution, if i understood something from it
cdkid Posted May 1, 2006 Posted May 1, 2006 What this does Func _SendDuration($v_Send, $i_Duration, $i_SendDownDelay = 1, $i_SendKeyDelay = 1) $OptSendDownDelay = Opt('SendKeyDownDelay', $i_SendDownDelay) $OptSendKeyDelay = Opt('SendKeyDelay', $i_SendKeyDelay) Local $SendTimer = TimerInit() Do Send($v_Send) Until TimerDiff($SendTimer) >= $i_Duration Opt('SendKeyDownDelay', $OptSendDownDelay) Opt('SendKeyDelay', $OptSendKeyDelay) EndFunc Is start a timer, and send the specified key until that timer = $i_Duration in miliseconds The two optional parameters are for setting the SendKeyDelay & SendKeyDownDelay while it does that. --Hope this helps ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
eco Posted May 1, 2006 Author Posted May 1, 2006 cdkid, i tried to put it in beginning of script, but no effect either strange that MouseDown("left") works, but not with keyboard but does it work to you? HotKeySet("{F11}", "start") HotkeySet("{HOME}","end") Opt("SendKeyDelay", 5) While 1 sleep ("100") WEnd Func start() Send("{a down}") Sleep(5000) Send("{a up}") EndFunc Func end() Exit 0 EndFunc
Moderators SmOke_N Posted May 1, 2006 Moderators Posted May 1, 2006 cdkid, i tried to put it in beginning of script, but no effect either strange that MouseDown("left") works, but not with keyboard but does it work to you? HotKeySet("{F11}", "start") HotkeySet("{HOME}","end") Opt("SendKeyDelay", 5) While 1 sleep ("100") WEnd Func start() Send("{a down}") Sleep(5000) Send("{a up}") EndFunc Func end() Exit 0 EndFuncHotKeySet("{F11}", "start") HotkeySet("{HOME}","end") While 1 Sleep(100) WEnd Func start() _SendDuration('a', 5000, 5, 5) EndFunc Func end() Exit 0 EndFunc Func _SendDuration($v_Send, $i_Duration, $i_SendDownDelay = 1, $i_SendKeyDelay = 1) $OptSendDownDelay = Opt('SendKeyDownDelay', $i_SendDownDelay) $OptSendKeyDelay = Opt('SendKeyDelay', $i_SendKeyDelay) Local $SendTimer = TimerInit() Do Send($v_Send) Until TimerDiff($SendTimer) >= $i_Duration Opt('SendKeyDownDelay', $OptSendDownDelay) Opt('SendKeyDelay', $OptSendKeyDelay) EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
eco Posted May 1, 2006 Author Posted May 1, 2006 it is more complicated than i thought, but it works, thanks, also thx to others
Moderators SmOke_N Posted May 1, 2006 Moderators Posted May 1, 2006 Nothing complicated really, I'll try to break it down for you:Func _SendDuration($v_Send, $i_Duration, $i_SendDownDelay = 1, $i_SendKeyDelay = 1)$v_Send = The character(s) you want to send $i_Duration = How long you want to send the character(s) $i_SendDownDelay = 1 = Optional Parameter -- If you need it longer than one for the Opt('SendKeyDownDleay') then you would use it like i did (5 or whatever) else you would not use it at all example _SendDuration('a', 5000) $i_SendKeyDelay = 1 = Same as above $OptSendDownDelay = Opt('SendKeyDownDelay', $i_SendDownDelay) $OptSendKeyDelay = Opt('SendKeyDelay', $i_SendKeyDelay) Storing the original settings for these Opt(s) so that you don't have to keep doing it throughout your script Local $SendTimer = TimerInit()Local (keeping the variable specific for this function) TimerInit() ; Start the timer for the $i_Duration settings Do Send($v_Send) Until TimerDiff($SendTimer) >= $i_DurationDo/Until is a loop, so you will continue to send your character(s) until the desired time (TimerDiff($SendTime)) has expired. Opt('SendKeyDownDelay', $OptSendDownDelay) Opt('SendKeyDelay', $OptSendKeyDelay)Re-storing back to what these Opt(s) were originally before you started the function. Hope that helps... It could even use another parameter for sending keys raw. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
greenmachine Posted May 1, 2006 Posted May 1, 2006 If you'll notice, the helpfile says this:To hold a key down (generally only useful for games) Send("{a down}") ;Holds the A key down Send("{a up}") ;Releases the A keyThe reason it is "generally only useful for games" is because it is designed to not send more than one key. Games respond to keys being held down the same regardless of settings on the computer, but keys being sent are subject to key delays (how long before repeating, what repeat rate...). Jon discussed this before, but I couldn't find the thread. Anyway, he said that it was made this way on purpose.The function provided above, while nice and potentially useful, is the same as doing Send ("{a XX}"), where XX is simply the number of keys sent during the time period. That could be calculated with some quick math beforehand, and then the function wouldn't be needed. Just so you know....
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