Sign in to follow this  
Followers 0
iCode

SendKeyDelay interaction with AHK script?

7 posts in this topic

A person using my script is running some AHK scripts that apparently use AHK's Send function to send a string of keys to an edit control (non-AHK i believe)

My script does not set the SendKey[Down]Delay times, so they should default to 5 ms

He is setting SendKeyDelay = 0 in his scripts

He has reported that his AHK scripts send keystrokes slower while my AutoIt script is running :)

Could there be some interaction there?


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites



What would i post?

I'm not using Opt("SendKeyDelay", n) in my script - i just wanted to know if anybody is aware of the default AutoIt SendKeyDelay (5ms) affecting the Send() function in AHK where there is a delay between sent keystrokes.

If you're thinking of something specific, let me know, otherwise i doubt anyone would be interested in sifting through 5000+ lines of code.


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites

I think the reasoning is, what is your script doing in the background that might be affecting his AHK script's timing? We don't know, and can't tell you, without knowing what it is your script is doing. Is it running an endless loop with no sleep in it, is it accessing something to do with the keyboard? Things like that.

Another thing, whatever the AHK script is doing, it can probably be done better with AutoIt and there wouldn't be any question as to what is happening.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

hi BrewManNH

i started to wonder exactly the same thing as i was thinking about this - here is the basic mechanics of it...

While 1

    Sleep(20)

    If $Enable = 0 Then
        ContinueLoop
    ElseIf _IsPressedEx("0x01") And Not _IsPressedEx("0x11") And Not _IsPressedEx("0x12") Then ; mouse 1
        ; then do stuff
    ElseIf _IsPressedEx("0x04") And Not _IsPressedEx("0x10") And Not _IsPressedEx("0x11") And Not _IsPressedEx("0x12") Then ; mouse 3
        ; then do stuff
    EndIf

WEnd

Func _IsPressedEx($sVKey)

    Local $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $sVKey)
    If @error Then Return SetError(@error, @extended, False)
    Return BitAND($aRet[0], 0x8000) <> 0

EndFunc

there's allot of code removed where i stuck "then do stuff", but basically i want to know when the left or middle mouse button is pressed

$Enable is usually 1, so i'm running through the full loop the vast majority of the time, which means every time the left mouse button is clicked, i'm checking that other keys are not (Ctrl, Alt) and then then running the rest of the code, which i can post if need be - i just have to format it so it's understandable :)


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites

You should be opening the DLL using DLLOpen before using the function _IsPressedEx (which by the way is identical to the _IsPressed function already in AutoIt), and pass the handle to the DLLCall instead of using the DLL name like you're doing.

I would imagine that all the _IsPressed checking you're doing is slowing down the processing of the keys being sent by the other script.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

a handle to the dll is open - i ommited that part

i'll post the rest of the while loop code as soon as i make a sample...


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0