imNew Posted January 31, 2013 Posted January 31, 2013 (edited) due to the nature of what I am doing, my keys will get stuck, unavoidable, I just need a reliable _clearKeys() My observation so far: send(key up) works ALL the time for normal keys, ie. asdf's same can't be said for ctrl alt and shift in a simple ctrl click: send("{ctrldown}") for $ i = 0 to 4 mouseclick("left", 11, 11) next send("{ctrlup}") in my particular instance, send("{lctrl down}"), send("{lctrldown}"), send("{ctrl up}"), send("{lctrl up}"), send("{lctrlup}") do not work or they will not free the ctrl key at the end. only send("{ctrlup}") works, but not always either. in severe cases, even a send ("ctrl") will get the ctrl key stuck (SendKeyDownDelay=30 or higher) What I am afraid is that, once the ctrl key is stuck in down position, all the subsequent send(key) will be interpreted as send(ctrl+key), EVEN the send( ctrl up) attempts. I would like a function that is lower level, something like _isPressed("12"), that can just clear all the "down" keys. my system is x64 windows 7. Edited January 31, 2013 by imNew
Danp2 Posted January 31, 2013 Posted January 31, 2013 You might want to read this FAQ entry.FWIW, I've been using the following with good success:Send("{SHIFTUP}{CTRLUP}{ALTUP}") Latest Webdriver UDF Release Webdriver Wiki FAQs
nitekram Posted January 31, 2013 Posted January 31, 2013 Just asking a question - is it possible to fix this? I know there is a work around in place - a few in fact. But just wondering if we can change the function/code to change the status of keys to what they were before this command Send() was used with the shift, ctrl, alt keys. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
JohnOne Posted January 31, 2013 Posted January 31, 2013 or more precisely http://www.autoitscript.com/wiki/FAQ#General_unstuck_method AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
imNew Posted February 1, 2013 Author Posted February 1, 2013 thanks a lot for the pointer. I will look at it more serious now.I m assuming ControlSend("","","","",0) won't work right? some key, any, has to be controlsent in order for that to work.
PhoenixXL Posted February 1, 2013 Posted February 1, 2013 why not use _Winapi_Keybd_event, twice once for pressing the key and the other for releasing it, I havent noticed any problems with it yet My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
JohnOne Posted February 1, 2013 Posted February 1, 2013 thanks a lot for the pointer. I will look at it more serious now.I m assuming ControlSend("","","","",0) won't work right? some key, any, has to be controlsent in order for that to work.Why would you assume that even with it being in the FAQ as an answer?Perhaps they just put it there for a laugh. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
imNew Posted February 1, 2013 Author Posted February 1, 2013 well, mostly because in ideal conditions, ie. testing in textpad, send (key up) operations will always free my keys, don't even need the controlSend. However I encounter loads of problems when the stuff I am trying to interface with doesn't register key presses in an orthodox way and there are delays as well. That's why after trying FAQs once without any breakthru, I gave up and came on the forum. Apparently the FAQ is the best solution, then I have to try to make it work.
JohnOne Posted February 1, 2013 Posted February 1, 2013 I just meant, you should not assume anything when all you need to do is test it. I have no idea why it works, I just know that it does. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators Melba23 Posted February 1, 2013 Moderators Posted February 1, 2013 imNew,I note your original post read:"in my particular instance (a game environment), send("{lctrl down}"), send("{lctrldown}"), send("{ctrl up}"), send("{lctrl up}"), send("{lctrlup}") do not work"I also note that you have amended this without being prompted - but please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing gane automation - before you post again. The fact that you are trying to use AutoIt in a game is undoubtedly why you are having these problems - therefore there seems little point in continuing with this thread. And so...... 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