Jump to content

Is autoit support delay betwen key input?


Recommended Posts

I assign (V + I) to open a website (vietnamnet dot vn).

Unfortunately, I have bad behavior that when fast typing, that when I press a key, then press second key, I still hold the first key for a very small time.

Example, to type a word visit, instead of type:

Key V                               Key I

----------------------------------       ----------------------------------

Press----------------------Release       Press----------------------Release

I often type:

Key V

----------------------------------

                                    Key I
                        ----------------------------------
                        Press----------------------Release

Press----------------------Release

The small time that both key V and I press make AutoIt lauch the website unintendly. I calculated that time about 100 miliseconds. I pretty confident that a lot of people who typing fast have same behavior like.

So I want a feature that AutoIt check every combine keys if each key is different time with other key atleast 200 miliseconds (If first key is Modifier key, then no need for this check, ...)

Not sure if AutoIt already have this feature yet, if have then pretty wonderful (pls tell me how to do that)

Link to comment
Share on other sites

Have a try with this:

Opt("SendKeyDownDelay", 200)

 

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

The easiest solution would be to not have two letter keys as a hotkey combination, but a combination with ctrl/shift/alt/windows key. Like ^!a for ctrl+alt+a. That way you have less chance of accidentally hitting the combo.

Anyway, how did you manage to set two base keys as a hotkey combination anyway?

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

@SadBunny Not a hotkey but here you go:

#include <Misc.au3>

Local $userdll = DllOpen("User32.dll")

While 1
    If _IsPressed(56, $userdll) And _IsPressed(49, $userdll) Then
        MsgBox(0, "", "hi you pressed V+I")
    EndIf
WEnd

DllClose($userdll)

 

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Thanks MikahS :) I know that way, but I wondered how OP did it, because a. it is nice to see that someone has tried, and b. what is the best solution depends on how he approached the thing in the first place.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

No problem @SadBunny

I agree, and was hoping OP would say he did it this way. But, exactly you never know. ^_^

 

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

I used this one:

~v & i::

Edit:

I certainly know I should use standard combine hot key (one or more modifier key + only one base key). But what if I want asign 30 hotkeys? Surely that is not too much, especially for websites, file, program,...

Use standard hotkey have it advance, but it also +) Hard to remember (you have alot) and +) conflic with application hotkey. This app use this hotkey, other app use other.

You may say that two-base key make typing difficult, but I accept and it does not a matter with me.

Infact I used AutoHotkey serveral years up to now, but for other things, not hotkey. At the start, I asign some hotkey like above, and believe that AutoHotkey doesn't support delay time, so I already write a C++ code to make it work. That is hard decision, thoungh, because I don't know anything about coding C/C++ at that time.

Now I use that hotkeys happlily, I have about 50 hotkeys, but I remember every single one, because I choose 2 or more base key, wich is short/stand for the name of website, application, file I want to open. And it never make me difficult when typing. The delay between base keys is 200 miliseconds make me (almost) never open that item un-intend when I typing.

Now as I use my app to make hotkey, I still use AutoHotkey for other purpose oftenly. I'm now just know enough C++ to make custom hotkey, no more, no less. But as the difficult with AutoHotkey before I decide to learn C++, I come here to share my opinion, hope this will be a usefull feed back. I use these type of hotkey for nearly a year, and feel really suite for me.

Quite a long post. Thank for your reading.

Edited by tkx11
Link to comment
Share on other sites

Incase some one want to know about my c++ method:

std::map<int, int> src; // <keyCode, TickCount>
    // Only track first time key Down, if the key is Repeated, ignore
    // When key is released, earse it
    //...
    
    // Whenever have keydown event, do following step.
    // Convert from <key, TichCount> to <TickCount, key>
    std::map<int, int> dst;
    for (auto& i : src)
    {
        dst[i.second] = i.first;
    }

    int time = 0; // Previous key TickCount
    int keys = 0; // Combined key
    bool modifier = false;
    for (auto i : dst)
    {
        if (i.second > 90) modifier = true; // If keyCode > 90, no need to check delay time
        if (i.first - time > 200 || modifier || keys > 1000)
        {
            keys = keys * 1000 + i.second; // Example: previous key is 'v' (86), current key is 'i' (73) -> 86 073
            time = i.first; // Last key time check
        }
    }
    
    switch (keys)
    {
    case 86073:  // v + i
        // ...
        break;
        
        //...
    }

 

Edited by tkx11
Link to comment
Share on other sites

  • Moderators

tkx11,

Infact I used AutoHotkey serveral years up to now, but for other things, not hotkey. 
[...]
I still use AutoHotkey for other purpose oftenly.

Those remarks, plus the fact that the syntax you posted is from AHK and not AutoIt makes me think you are on the wrong forum.  I suggest you post your request on the forum for the language you are using.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...