- AuthorPosts
- February 23, 2013 at 8:54 pm #10855StefanParticipant
.
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 pressselText = document.selection.Text;
varK = “”;
while(varK==””){
varK = GetKey();
wait 200ms;
}
document.selection.Text = varK + selText + varKThe point is: no dialog involved!
Or perhaps useful for
while(varK.length < 5){
varK = varK + GetKey();
}.
February 24, 2013 at 12:48 pm #10860StefanParticipant.
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!?!?February 24, 2013 at 6:39 pm #10861Yutaka EmuraKeymasterHi 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!
February 27, 2013 at 6:45 pm #10871StefanParticipant.
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 macroI 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.
February 27, 2013 at 7:00 pm #10872Yutaka EmuraKeymasterHi 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!
February 28, 2013 at 7:57 am #10873StefanParticipant.
Ah, i see. To bad.
Thank you for the clarification.
.
December 4, 2013 at 6:02 am #17585jesus2099ParticipantHello 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.December 5, 2013 at 3:02 pm #17606Yutaka EmuraKeymasterHi 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! - AuthorPosts
- You must be logged in to reply to this topic.