Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6650
    masha
    Member

    Hello.

    How to hook all keyboard and mouse input for a given window ?
    Can I write a macro which will handle Ctrl-click or Shift-click on the document window and then will do something with the clicked word?

    #6656
    dreftymac
    Participant

    I don’t know if there is a way to trigger a macro with a mouse click, but you can trigger a macro using a keyboard shortcut. You can also use a single keyboard shortcut to trigger multiple choices for the user, so you do not have to restrict your macro to doing just one “action”.

    The following example uses the document.selection and the CreatePopupMenu function inside a jsee macro. The popup menu gives the user multiple choices before displaying the result.


    var vtext = document.selection.Text;
    var result = '';
    var menu = CreatePopupMenu();
    menu.Add( "look north", 1 );
    menu.Add( "look south", 2 );
    menu.Add( "look east", 3 );
    result = menu.Track( 0 );
    if( result != 0 ) {
    result = ( menu.GetText( result ) );
    }
    Window.alert([result,vtext].join(' '));
    #6661
    Yutaka Emura
    Keymaster

    masha wrote:
    Hello.

    How to hook all keyboard and mouse input for a given window ?
    Can I write a macro which will handle Ctrl-click or Shift-click on the document window and then will do something with the clicked word?

    You can find some events by going to the Macros menu, Customize, check Runs at Events, and then click the Events button. But that is all we have. For mouse clicks, you will need to write a plug-in.

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