#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(' '));