BrainDrain Posted March 19, 2010 Share Posted March 19, 2010 Hi, i try to write a script to close the brackets "({[" by a script. Why does the following script not work? If I use the part with "(" only everything is fine. But if I use the lines with "[" and "{" too I have some ''funny'' results like Keyboard is blocked afterwards. Any help is welcome. HotKeySet("(","WriteCloser_1") HotKeySet("[","WriteCloserEk") HotKeySet("{{}","WriteCloser_3") While 1 Sleep(500) WEnd Func WriteCloser_1() HotKeySet("(") Send("(") Send(")") Send("{LEFT}") HotKeySet("(","WriteCloser_1") EndFunc Func WriteCloserEk() HotKeySet("[") Send("[") Send("]") Send("{LEFT}") HotKeySet("[","WriteCloserEk") EndFunc Func WriteCloser_3() HotKeySet("{{}") Send("{{}") Send("{}}") Send("{LEFT}") HotKeySet("{{}","WriteCloser_3") EndFunc Link to comment Share on other sites More sharing options...
l3ill Posted March 19, 2010 Share Posted March 19, 2010 Hi, and Welcome! try this: HotKeySet("(","WriteCloser_1") HotKeySet("[","WriteCloserEk") HotKeySet("{{}","WriteCloser_3") While 1 Sleep(500) WEnd Func WriteCloser_1() HotKeySet("(") Send("(") Send(")") EndFunc Func WriteCloserEk() HotKeySet("[") Send("[") Send("]") EndFunc Func WriteCloser_3() HotKeySet("{{}") Send("{{}") Send("{}}") EndFunc accomplishes the same thing without the last 2 steps. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
BrainDrain Posted March 19, 2010 Author Share Posted March 19, 2010 Hi billo, thank you for your answer, but it does not working too. If I open a editor (Notepad++ in my case) The keybord is blocked after pressing the "[" key. Link to comment Share on other sites More sharing options...
l3ill Posted March 19, 2010 Share Posted March 19, 2010 Ah, I see what you mean...answered too fast. try this: HotKeySet("{F1}", "_F1") HotKeySet("{F2}", "_F2") HotKeySet("{F3}", "_F3") While 1 Sleep(500) WEnd Func _F1() Send("(") Send(")") EndFunc Func _F2() Send("{") Send("}") EndFunc Func _F3() Send("[") Send("]") EndFunc My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
JSThePatriot Posted March 19, 2010 Share Posted March 19, 2010 Hi billo, thank you for your answer, but it does not working too. If I open a editor (Notepad++ in my case) The keybord is blocked after pressing the "[" key. BrainDrain, I notice you're using a hotkey of "{{}" That hotkey would be very hard to press. You don't have two keys with the '{' character on them. Therefore it will never be hit. Also I would recommend you search the forum for _IsPressed(). Actually it is in the helpfile as a UDF include these days I believe. Check it out. It will be potentially much more helpful. You simply want to re-act to certain combinations of key presses not react to a specific hotkey. I hope this helps you on your journey, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
BrainDrain Posted March 19, 2010 Author Share Posted March 19, 2010 Thank you for your answers. @billo of course I can use F1 F2 F3 but that is not what I want. I'd like to use the "{" and "[" as usual and autoIt should close the brackets and put the cursor between them. Perhaps I'll find a solution in JSThePatriot hint. Link to comment Share on other sites More sharing options...
l3ill Posted March 19, 2010 Share Posted March 19, 2010 Nice tip! another one for my box of stuff... #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("DB", $dll) Then Send("{]}") Send("{LEFT}") ExitLoop EndIf WEnd DllClose($dll) Thanks JS My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
JSThePatriot Posted March 19, 2010 Share Posted March 19, 2010 Nice tip! another one for my box of stuff... #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("DB", $dll) Then Send("{]}") Send("{LEFT}") ExitLoop EndIf WEnd DllClose($dll) Thanks JS Happy to be of service...I hope it helps the OP as well! Regards, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
martin Posted March 19, 2010 Share Posted March 19, 2010 On a UK keyboard, and probably many others, you don't want HotKeySet("{{}","WriteCloser_3") you want HotKeySet("+[","WriteCloser_3") and no need for _IsPressed. HotKeySet("+[", "WriteCloser_3") While 1 Sleep(90) WEnd Func WriteCloser_3() HotKeySet("+[") Send("{") Send("}") HotKeySet("+[", "WriteCloser_3") EndFunc ;==>setcurly Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
BrainDrain Posted March 22, 2010 Author Share Posted March 22, 2010 Hello , thank you again. @martin: On a german keybord the "[" and "{" brackes need the ALT GR key that is {RALT} for AutoIt. But {RALT} can't be used for a Hotkey in Combination with another key. Or am I wrong? HotKeySet("{RALT}0") but it does not work (like I have expected). So I have to use the _IsPressed solution. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 22, 2010 Share Posted March 22, 2010 (edited) Alt Gr is actually Ctrl+Alt.#Include <Misc.au3> $dll = DllOpen("user32.dll") HotKeySet("^!0", "WriteCloser_3") While 1 Sleep(90) WEnd Func WriteCloser_3() HotKeySet("^!0") Do Until _IsPressed("11", $dll) <> 1 Send("{") Send("}") HotKeySet("^!0", "WriteCloser_3") EndFunc ;==>setcurlyThis works fine on my swedish keyboard. The _IsPressed() is there because the Ctrl key just got stuck for me without it. Edited March 22, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
BrainDrain Posted March 22, 2010 Author Share Posted March 22, 2010 Thank you AdmiralAlkex that is exactly what I was looking for. except it's "^!7" for opening bracket :-) It's working on my german keybord as well. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 23, 2010 Share Posted March 23, 2010 I know 7 is opening bracket, I just used 0 as you had yourself in the previous post HotKeySet("{RALT}0") but it does not work (like I have expected). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
electrico Posted March 23, 2010 Share Posted March 23, 2010 Looks like you are use brackets very ofthen, - developer? Sorry that is not topic answer, but man, do you like typing? If yes, just pass through all of "Solo on the keyboard" exercises, and you will not need hotkeys for putting special simbols and brackets. You will type fast and clear. 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