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();
}
.
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();
}
.
.
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!?!?
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!?!?
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://emeditor.wpengine.com/help/howto/plugin/plugin_snippets.htm
Thanks!
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://emeditor.wpengine.com/help/howto/plugin/plugin_snippets.htm
Thanks!
.
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.
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.
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!
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!
.
Ah, i see. To bad.
Thank you for the clarification.
.
Ah, i see. To bad.
Thank you for the clarification.
.
Hello Yutaka,
Sorry for digging up this old topic but I would like to know if there is a way to get the last key pressed (with modifiers etc.).
This way I could know what keyboard shortcut did launch the current macro and make various actions depending on it.
For instance I could have all my AutoHotkey macros in a single .jsee macro file, switching the code depending on the pressed keys.
Hi PATATE12,
Unfortunately, there is no way to get the last key pressed. As I wrote before, the best way is to use the Snippets plug-in. Please try it.
Thanks!
8 posts in this topic