Mouse Gestures for Internet Explorer - Script API

The Mouse Gestures plugin executes any scripts via the IHTMLWindow2::execScript API:

Description A description of the script that will appear in the list of actions
Language The language the script is written in - as passed to IHTMLWindow2::execScript
Script The script to be executed. See below for details of the Mouse Gestures API

Scripting API

Access to the MouseGestures scripting API is via the mg object.

mg.anchorList Get a VB Safe Array of anchors that the mouse passed over during the last gesture
  • mg.anchorList[ n ]
Get the n'th item in the list of anchors
mg.browser Get the WebBrowser object where the mouse gesture was drawn. Get the tab helper object for manipulating IE's tabs
Close the active tab
Goto the next tab
Goto the previous tab
Create a new tab
Duplicate the active tab Get the active application object
mg.startAnchor Get the address of the anchor where the gesture was started. If the gesture wasn't started over an anchor, an empty string is returned
mg.path Gets a VB Safe Array containing the points in the path of the last gesture
  • mg.path[ n ]
Get the n'th element in the path
  • mg.path[ n ].x
Get the X coordinates of the path element
  • mg.path[ n ].y
Get the Y coordinates of the path element
  • mg.path[ n ].toString()
Get a string representation of the path element
mg.runScript( fileName, language ) Run an external script:
  • fileName - the fileName of the script to run
  • language the language of the script (e.g. VBScript, JScript etc.)
mg.actions Get a collection containing all the actions supported by the Mouse Gestures plugin
  • mg.actions[ n ]
Get the nth action in the actions collection
  • mg.actions[ "Name" ]
Get the action with the specified name from the actions collection
  • mg.actions[ n ].type
Get a string representing the type of the action. Can be one of:
  • Builtin
  • Favourite
  • Script
  • Keystroke
  • mg.actions[ n ].description
Get a string describing the action.
  • mg.actions[ n ].execute
Execute the action

Example scripts

All the examples below are in JScript

List the anchors

var sl = mg.anchorList.toArray(); 
var str = String();

for( i = 0; i < sl.length; ++i )
    str = str + sl[ i ].href;
    str = str + "\n";

alert( str );

List the points in the gesture

var path = mg.path;
var sl = path.toArray(); 
var str = String(); 

for( i = path.lbound(); i <= path.ubound(); ++i )
    str = str.concat( sl[ i ].toString(), "\n" ); 

alert( str );

Manipulate the browser

Go forward in the page history


Go back in the page history


Execute a Mouse Gesture Action

mg.actions( "Select All" ).execute();
mg.actions( "Copy" ).execute();
mg.actions( "Clear Selection" ).execute();

Close the active tab;

Go up one level in the site hierarchy

var re = /(.*)\/[^\/]+/g;
var url = location.href;
navigate( url.replace( re, "$1" ) );

See also

Mouse Gestures for Internet Explorer is completely free, but if you want to contribute towards the running costs of this website, then please click on the button on the right and donate via PayPal