EmEditor (text editor) Forum Index Enhancement Suggestions about Macros
Wait for key press, get Key | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| Stefan | Posted on: 2/23/2013 11:54 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 261 |
Wait for key press, get Key .
Hi Yutaka I need a feature to get the key an user has pressed. I want to omit the usual InputBox() dialog. Example script: varK = GetKey(); alert('You have pressed ' + varK); OR - select a word - execute macro - macro is waiting for a key press selText = document.selection.Text; varK = ""; while(varK==""){ varK = GetKey(); wait 200ms; } document.selection.Text = varK + selText + varK The point is: no dialog involved! Or perhaps useful for while(varK.length < 5){ varK = varK + GetKey(); } . |
| Stefan | Posted on: 2/24/2013 3:48 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 261 |
Re: Wait for key press, get Key .
Ahh, just forgot: while GetKey() is waiting, the keypress should not be processed to the document but only to the macro. That means: if i have a selection this should not get dropped by the key press. OTOH, i could catch the selection from the macro too before waiting for the key!?!? |
| Yutaka | Posted on: 2/24/2013 9:39 am |
Webmaster ![]() ![]() Joined: 9/28/2006 From: Redmond Posts: 2398 |
Re: Wait for key press, get Key Hi Stefan,
An easy way is to utilize our Snippets plug-in. Can you try using the Snippets plug-in? Lots of information can be viewed at http://www.emeditor.com/help/howto/plugin/plugin_snippets.htm Thanks!
|
| Stefan | Posted on: 2/27/2013 9:45 am |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 261 |
Re: Waiting for a key press, get Key .
Hi Yutaka, i think you know that i already utilize the snippets a lot. But i don't know how i can wait for a key press. Basically i want to - start a macro - wait for the user pressing any key - store that key to a variable - continuing the macro I have many ideas to use this. If you happen to know how i can do this right now, please tell me by an example. If it is not possible right now, please consider to implement something like "GetKeyPress();" Thank you. |
| Yutaka | Posted on: 2/27/2013 10:00 am |
Webmaster ![]() ![]() Joined: 9/28/2006 From: Redmond Posts: 2398 |
Re: Waiting for a key press, get Key Hi Stefan,
It is not possible to wait for a particular key while running a macro. This is because macros do not run asynchronously. This is limitation of macros. What I mean by using Snippets is using a Keyboard shortcut for each snippet. Thanks!
|
| Stefan | Posted on: 2/27/2013 10:57 pm |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 261 |
Re: Waiting for a key press, get Key .
Ah, i see. To bad. Thank you for the clarification. . |
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |




