Photoshop CC 2015 scripting keydown event not working
This Mike Hale script works prior to CC 2015
function NumericEditKeyboardHandler (event) {
try {
var keyIsOK = KeyIsNumeric (event) ||
KeyIsDelete (event) ||
KeyIsLRArrow (event) ||
KeyIsTabEnterEscape (event);
if (! keyIsOK) {
// Bad input: tell ScriptUI not to accept the keydown event
event.preventDefault();
/* Notify user of invalid input: make sure NOT
to put up an alert dialog or do anything which
requires user interaction, because that
interferes with preventing the 'default'
action for the keydown event */
app.beep();
}
}
catch (e) {
; // alert ("Ack! bug in NumericEditKeyboardHandler: " + e);
}
}
// key identifier functions
function KeyIsNumeric ( event ) {
return ( event.keyName >= '0' ) && ( event.keyName < 0 || Number(this.text) > 100 ){
alert('Out of range');
// handle however you like
this.text = '';
}
}
w.btnPnl.okBtn. function ( ) { this.parent.parent.close( 1 ); alert("OK"); };
w.btnPnl.cancelBtn. function ( ) { this.parent.parent.close( 2 ); alert("Cancel");};
};
runDialog = function( w ) {
return w.show( );
};
var win = createDialog();
initializeDialog( win );
runDialog( win );
JJMack