Hi Michael,
After releasing new beta you have surely time for hanging around... hehe... Anyway, could you spend some time advising me on scripting?
I'd like to make a script enabling to define a two-key shortcuts for a given group of commands. I've written some code, but I'm not able to find any MoI's object that can receive a keyboard event. I've also tried ineffectually to grab some UI using getUIPanel() method for window.event.keyCode property.
I'm just wondering if is there currently a way to get the following script working or I must write related html file with a form and "onkeypress/onchange..." handling.
// boolean group is called with shortcut B=Booleans.js
// something is missing here...
while ( 1 )
{
var key = WHICH_OBJECT?.event.keyCode;
if ( typeof( key ) == 'number' )
break;
}
var keychar = String.fromCharCode( key ).toLowerCase();
// bu ->BooleanUnion
if ( keychar == 'u' )
moi.command.execCommand( 'BooleanUnion' );
// bd ->BooleanDifference
else if ( keychar == 'd' )
moi.command.execCommand( 'BooleanDifference' );
// bi ->BooleanIntersection
else if ( keychar == 'i' )
moi.command.execCommand( 'BooleanIntersection' );
Thanks,
Petr
|