Copy link to clipboard
Copied
How do I open the new document dialog?
I've tried the script listener but it didn't seem to help.
I assume it can be done using app.runMenuItem() but I don't know the menuid.
#target photoshop
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
// New Doc
function NewDoc() {
// Make
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putClass(cTID('Md '), sTID("RGBColorMode"));
desc2.putUnitDouble(cTID('Wdth'), c
...Copy link to clipboard
Copied
var idOpn = charIDToTypeID( "Opn " );
executeAction( idOpn, undefined, DialogModes.NO );
Record action and then you see code in script listener
http://sklad.bereza.cz/00-jarda/00_screenshot/2016-10-18_185756.jpg
http://sklad.bereza.cz/00-jarda/00_screenshot/2016-10-18_185809.jpg
Copy link to clipboard
Copied
#target photoshop
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
// New Doc
function NewDoc() {
// Make
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putClass(cTID('Md '), sTID("RGBColorMode"));
desc2.putUnitDouble(cTID('Wdth'), cTID('#Rlt'), 570);
desc2.putUnitDouble(cTID('Hght'), cTID('#Rlt'), 380.16);
desc2.putUnitDouble(cTID('Rslt'), cTID('#Rsl'), 300);
desc2.putDouble(sTID("pixelScaleFactor"), 1);
desc2.putEnumerated(cTID('Fl '), cTID('Fl '), cTID('Wht '));
desc2.putInteger(cTID('Dpth'), 8);
desc2.putString(sTID("profile"), "none");
desc1.putObject(cTID('Nw '), cTID('Dcmn'), desc2);
desc1.putInteger(cTID('DocI'), 850);
executeAction(cTID('Mk '), desc1, dialogMode);
};
step1(true, true); // Make
};
NewDoc.main = function () {
NewDoc();
};
NewDoc.main();
Copy link to clipboard
Copied
Thanks.
I cut it down to the minimum I could since I just need it to trigger the dialog and not change the previous values inside it.
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var desc1 = new ActionDescriptor();
desc1.putObject(cTID('Nw '), cTID('Dcmn'), new ActionDescriptor());
try{executeAction(cTID('Mk '), desc1, DialogModes.ALL);}catch(e){}
app.displayDialogs = DialogModes.NO;
Copy link to clipboard
Copied
Below is the scriptlistener code. You need to change the last line to turn on the dialog box if you wantto see it.
var idMk = charIDToTypeID( "Mk " );
var desc4 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var desc5 = new ActionDescriptor();
var idMd = charIDToTypeID( "Md " );
var idRGBM = charIDToTypeID( "RGBM" );
desc5.putClass( idMd, idRGBM );
var idWdth = charIDToTypeID( "Wdth" );
var idRlt = charIDToTypeID( "#Rlt" );
desc5.putUnitDouble( idWdth, idRlt, 2160.000000 );
var idHght = charIDToTypeID( "Hght" );
var idRlt = charIDToTypeID( "#Rlt" );
desc5.putUnitDouble( idHght, idRlt, 1440.000000 );
var idRslt = charIDToTypeID( "Rslt" );
var idRsl = charIDToTypeID( "#Rsl" );
desc5.putUnitDouble( idRslt, idRsl, 72.000000 );
var idpixelScaleFactor = stringIDToTypeID( "pixelScaleFactor" );
desc5.putDouble( idpixelScaleFactor, 1.000000 );
var idFl = charIDToTypeID( "Fl " );
var idFl = charIDToTypeID( "Fl " );
var idWht = charIDToTypeID( "Wht " );
desc5.putEnumerated( idFl, idFl, idWht );
var idDpth = charIDToTypeID( "Dpth" );
desc5.putInteger( idDpth, 8 );
var idprofile = stringIDToTypeID( "profile" );
desc5.putString( idprofile, """sRGB IEC61966-2.1""" );
var idDcmn = charIDToTypeID( "Dcmn" );
desc4.putObject( idNw, idDcmn, desc5 );
var idDocI = charIDToTypeID( "DocI" );
desc4.putInteger( idDocI, 195 );
//executeAction( idMk, desc4, DialogModes.NO ); change this line to the following line
executeAction( idMk, desc4, DialogModes.ALL );
app.displayDialogs = DialogModes.NO; //make sure you turn the dialogs off again!!!!