jplumb Posted March 16, 2018 Share Posted March 16, 2018 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 More sharing options...
Danp2 Posted March 16, 2018 Share Posted March 16, 2018 It may help if you share more information regarding the program you are trying to automate. Have you looked into using ControlSend instead of Send? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 16, 2018 Moderators Share Posted March 16, 2018 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 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 Link to comment Share on other sites More sharing options...
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