Jump to content

Register keystrokes


Recommended Posts

Hey there, I have a script running that just helps me automate some of my mundane daily tasks, but one of the programs it works with requires the program to be the active window to accept control clicks, which isn't a problem. However, I am running into an annoyance, where if I'm typing or working in another window, the script takes focus away for just a moment to activate the other window and control click, then return focus back to my original working window. Because I'm usually typing in the other window, I use BlockInput($BI_DISABLE) so that whatever I'm typing or working on doesn't affect the control of my script, then BlockInput($BI_ENABLE) when the script has finished.

The problem I have is that the tiny switch in windows often makes whatever I'm typing lose a letter here or there. Although I've gotten good at temporarily halting my typing during the script control, I was thinking there might be a better way, but all of my searches keep returning the now-removed Recorder tool to record and playback input, which is not what I'm looking for, so maybe I'm just having a hard time with keywords in my searches.

What I want is for the script to take control, but still record whatever keys I continue to press while the script has control, and when the script returns focus back, I want it to then Send() the keys that were pressed while the script had focus, so that I can continue typing and working at full pace and have the script simply "catch up" when focus is returned.

Any suggestions? I'm a native C# programmer, so I know I could use keydown events there, but I was not having much luck with finding a working example for AutoIt.

Thanks.

Link to comment
Share on other sites

  • Moderators

jplumb,

Quote

record whatever keys I continue to press

I quite understand that you are not looking to create a keylogger in the malicious sense - but that is exactly what the code for which you are asking will be.  And as we do not support such things, I do not want to see ANY attempt by ANYONE to give you such a solution - future responders may consider themselves suitably warned!

Far better to run with Danp2's idea to remove the requirement.

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...