-
1. Re: Simulate pressing Enter Key
c.pfaffenbichler May 20, 2014 2:39 AM (in response to Apod42)May I ask what exactly are you trying to achieve?
-
2. Re: Simulate pressing Enter Key
Apod42 May 20, 2014 2:49 AM (in response to c.pfaffenbichler)Hello,
Using photoshop's script listner I recorded in a .jsx file some print actions. Just before printing I get the warning "The image is larger than the paper's printable area, and some clipping will occur". I do not whis to fix the problem that causes this warning, numerous reasons. I have to click "Proceed" (or hit the Enter key) to continue, No big deal, but when you do this thousands of times it becomes a big deal
My plan:
1. either stop photoshop from showing this warning (or any warnings). - No luck
2. Simulate an enter key hit and proceed with printing
Here is part of the script, the problem appears just below the first block (see my comment):
// =======================================================
var id25 = charIDToTypeID( "setd" );
var desc9 = new ActionDescriptor();
var id26 = charIDToTypeID( "null" );
var ref8 = new ActionReference();
var id27 = charIDToTypeID( "Prpr" );
var id28 = stringIDToTypeID( "printOptions" );
ref8.putProperty( id27, id28 );
var id29 = charIDToTypeID( "Dcmn" );
var id30 = charIDToTypeID( "Ordn" );
var id31 = charIDToTypeID( "Trgt" );
ref8.putEnumerated( id29, id30, id31 );
desc9.putReference( id26, ref8 );
var id32 = charIDToTypeID( "T " );
var desc10 = new ActionDescriptor();
var id33 = charIDToTypeID( "PgSt" );
var desc11 = new ActionDescriptor();
var id34 = charIDToTypeID( "Rslt" );
var id35 = charIDToTypeID( "#Pxl" );
desc11.putUnitDouble( id34, id35, 300.000000 );
var id36 = charIDToTypeID( "PgPs" );
var id37 = charIDToTypeID( "PgPs" );
var id38 = stringIDToTypeID( "userDefined" );
desc11.putEnumerated( id36, id37, id38 );
var id39 = charIDToTypeID( "Left" );
var id40 = charIDToTypeID( "#Rlt" );
desc11.putUnitDouble( id39, id40, 0.000000 );
var id41 = charIDToTypeID( "Top " );
var id42 = charIDToTypeID( "#Rlt" );
desc11.putUnitDouble( id41, id42, 1.417323 );
var id43 = charIDToTypeID( "Scl " );
var id44 = charIDToTypeID( "#Prc" );
desc11.putUnitDouble( id43, id44, 100.000000 );
var id45 = charIDToTypeID( "PgSt" );
desc10.putObject( id33, id45, desc11 );
var id46 = charIDToTypeID( "PMps" );
var desc12 = new ActionDescriptor();
var id47 = charIDToTypeID( "PstS" );
desc12.putBoolean( id47, true );
var id48 = charIDToTypeID( "Inte" );
var id49 = charIDToTypeID( "Inte" );
var id50 = charIDToTypeID( "Clrm" );
desc12.putEnumerated( id48, id49, id50 );
var id51 = charIDToTypeID( "SstI" );
desc12.putData( id51, String.fromCharCode( 189, 0, 1, 0, 226, 2, 0, 0, 226, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 181, 33, 0, 0, 213, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 181, 33, 0, 0, 213, 23, 0, 0, 0, 1, 123, 5, 0, 0, 224, 3, 0, 0, 1, 0, 1, 0, 1, 0, 108, 108, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) );
var id52 = charIDToTypeID( "PMps" );
desc10.putObject( id46, id52, desc12 );
var id53 = stringIDToTypeID( "printOptions" );
desc9.putObject( id32, id53, desc10 );
executeAction( id25, desc9, DialogModes.NO );
// Here is where the warning pops up. It is here that I need to simulate an enter key hit...
// =======================================================
var id54 = charIDToTypeID( "Prnt" );
var desc13 = new ActionDescriptor();
var id55 = charIDToTypeID( "PstS" );
desc13.putBoolean( id55, true );
var id56 = charIDToTypeID( "Inte" );
var id57 = charIDToTypeID( "Inte" );
var id58 = charIDToTypeID( "Clrm" );
desc13.putEnumerated( id56, id57, id58 );
var id59 = charIDToTypeID( "SstI" );
desc13.putData( id59, String.fromCharCode( 189, 0, 1, 0, 226, 2, 0, 0, 226, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 181, 33, 0, 0, 213, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 181, 33, 0, 0, 213, 23, 0, 0, 0, 1, 123, 5, 0, 0, 224, 3, 0, 0, 1, 0, 1, 0, 1, 0, 108, 108, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) );
executeAction( id54, desc13, DialogModes.NO );
-
3. Re: Simulate pressing Enter Key
boo radley 2013 May 27, 2014 10:26 AM (in response to Apod42)I don't know if javascripting can do it, but you can simulate pressing the enter key with another 3rd party application called AutoHotKey - it will do exactly what you want. Check it out, it's easy to find on the web, they have their own huge message forum with thousands of sample scripts, advice, etc.
-
4. Re: Simulate pressing Enter Key
Apod42 May 27, 2014 11:11 AM (in response to boo radley 2013)Thank you! Will give it a try!


