tkx11 Posted May 13, 2015 Posted May 13, 2015 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----------------------ReleaseI often type:Key V ---------------------------------- Key I ---------------------------------- Press----------------------Release Press----------------------ReleaseThe 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)
MikahS Posted May 13, 2015 Posted May 13, 2015 (edited) Have a try with this:Opt("SendKeyDownDelay", 200) Edited May 13, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
SadBunny Posted May 13, 2015 Posted May 13, 2015 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.
MikahS Posted May 13, 2015 Posted May 13, 2015 @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 ~ getENVvarsMy 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
SadBunny Posted May 13, 2015 Posted May 13, 2015 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.
MikahS Posted May 13, 2015 Posted May 13, 2015 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 ~ getENVvarsMy 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
tkx11 Posted May 16, 2015 Author Posted May 16, 2015 (edited) 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 May 16, 2015 by tkx11
tkx11 Posted May 16, 2015 Author Posted May 16, 2015 (edited) 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 May 16, 2015 by tkx11
tkx11 Posted May 16, 2015 Author Posted May 16, 2015 Have a try with this:Opt("SendKeyDownDelay", 200) I not sure what you suggest, but I think that is for send key function, not trigger hotkey (maybe I mis-understand or not).
Moderators Melba23 Posted May 16, 2015 Moderators Posted May 16, 2015 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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