danusko Posted May 25, 2005 Posted May 25, 2005 Hi everybody, sorry for my English but i am helpless . I want to install on my computer this action. Everytime i press the ESC (Escape) key, i want send ALT+F4 (close) except, when i am in Microsoft Office (Excel or Word - is active window), i want to send clasical ESC.I write this script, but it doesnt works right. It works when i close window of folder or other windows - but when i want to send ESC in Excel, it doesnt do nothing and after a few second show erorr info:"Recursion level has been exceeded - Autoit will quit to prevent stack overflow"Can you help me pls. Thank you very much. This is my script:-----------------------------------$a=1doHotKeySet("{ESC}", "CloseWin");ESCuntil $a=0Func CloseWin()if WinActive("Microsoft Excel","") then Send("{ESC}")elseSend("!{F4}")endifEndFunc-----------------------------------
CyberSlug Posted May 25, 2005 Posted May 25, 2005 (edited) The problem is Send("{ESC}") triggers the HotKeySet function which calls itself...... Based on the HotKeySet help file example/remarks: HotKeySet("{Esc}", "CloseWindow") While 1 sleep(100) Wend Func CloseWindow() ; ... can do stuff here HotKeySet("{Esc}");unregister hotkey If WinActive("Microsoft Excel") Then Send("{Esc}") Else Send("!{F4}") EndIf HotKeySet("{Esc}", "CloseWindow");re-register EndFunc Edited May 25, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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