Tagged: , , , ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #10855
    Stefan
    Participant

    .

    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();
    }

    .

    #10860
    Stefan
    Participant

    .

    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!?!?

    #10861
    Yutaka Emura
    Keymaster

    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!

    #10871
    Stefan
    Participant

    .

    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.

    #10872
    Yutaka Emura
    Keymaster

    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!

    #10873
    Stefan
    Participant

    .

    Ah, i see. To bad.

    Thank you for the clarification.

    .

    #17585
    jesus2099
    Participant

    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.

    #17606
    Yutaka Emura
    Keymaster

    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!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.