mutesoundbox Posted January 23, 2014 Posted January 23, 2014 Dear forum, I have recently discovered AUTOIT and am thrilled with what it is able to do! I've tried writing a script but interestingly, I run into two problems: 1) As many others have come across, my ctrl key gets stuck. I'm not sure my application is the same with the solutions others have given, as I have tried these solutions and it doesn't seem to help (though it may just be that I'm not doing it right) 2) In the code below, when I hit Ctrl+Pause on my keyboard (which should make it behave like Ctrl+Home), the effect I get is Ctrl+End (cursor moves to the end of the document). Using Ctrl+End elicits the same result. And curiously.....Ctrl+ScrLk (which isn't even written into the script!) elicits the same result too!! Is this because my keyboard is just that dumb? I should mention that this is because my keyboard layout is really ill-designed. I use F2, F4, and F12 a LOT, so I have my Fn key set so that I can hit these keys normally (and use Fn+F2 for volume down, for example). But this action replaced my Home, End, PgUp, and PgDn keys with Pause, Break, ScrLk, and Insert, four keys I have never used. The code below is thus a workaround for this. I just want to be able to use Ctrl+Home and Ctrl+Shift+Home again like before, for word processing Thanks everyone Here's the code: expandcollapse popupHotKeySet("{PAUSE}","_pause") HotKeySet("{BREAK}","_break") HotKeySet("{SCROLLLOCK}","_scrolllock") HotKeySet("{INSERT}","_insert") HotKeySet("+{PAUSE}","_spause") HotKeySet("+{BREAK}","_sbreak") HotKeySet("+{SCROLLLOCK}","_sscrolllock") HotKeySet("+{INSERT}","_sinsert") HotKeySet("^{PAUSE}","_cpause") HotKeySet("^{BREAK}","_cbreak") While 1 Sleep(100) WEnd Func _pause() Send("{HOME}") EndFunc Func _break() send("{END}") EndFunc Func _scrolllock() Send("{PGUP}") EndFunc Func _insert() Send("{PGDN}") EndFunc Func _spause() Send("{LSHIFT down}{HOME}{LSHIFT up}") EndFunc Func _sbreak() Send("{LSHIFT down}{END}{LSHIFT up}") EndFunc Func _sscrolllock() Send("{LSHIFT down}{PGUP}{LSHIFT up}") EndFunc Func _sinsert() Send("{LSHIFT down}{PGDN}{LSHIFT up}") EndFunc Func _cpause() Send("{CTRLDOWN}") Sleep(10) Send("{CTRLUP}") Send("{RCTRL down}{HOME}{RCTRL up}") EndFunc Func _cbreak() Send("{CTRLDOWN}") Sleep(10) Send("{CTRLUP}") Send("{RCTRL down}{END}{RCTRL up}") EndFunc
jdelaney Posted January 23, 2014 Posted January 23, 2014 (edited) At the end of each of your functions, do a: Send("") to release all 'stuck' keys Edited January 23, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
mutesoundbox Posted January 24, 2014 Author Posted January 24, 2014 Dear Jdelaney, Thank so much for the suggestion--I implemented it into my functions but alas, the problem continues to occur. The relevant sections are now as follows: HotKeySet("^{PAUSE}","_cpause") HotKeySet("^{BREAK}","_cbreak") Func _cpause() Send("{CTRLDOWN}") Sleep(10) Send("{CTRLUP}") Send("{RCTRL down}{HOME}{RCTRL up}") Send("") EndFunc Func _cbreak() Send("{CTRLDOWN}") Sleep(10) Send("{CTRLUP}") Send("{RCTRL down}{END}{RCTRL up}") Send("") EndFunc As far as I can tell, the behavior of the script is identical to before--and it still behaves weirdly (i.e., send ctrl+end and the ctrl key is stuck) when I hit ctrl+ScrLk. Did I implement the Send("") incorrectly? Thanks again, James
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