• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Open New Document Dialog

Participant ,
Oct 18, 2016 Oct 18, 2016

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.

TOPICS
Actions and scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Oct 18, 2016 Oct 18, 2016

#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

...

Votes

Translate

Translate
Adobe
Enthusiast ,
Oct 18, 2016 Oct 18, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 18, 2016 Oct 18, 2016

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 19, 2016 Oct 19, 2016

Copy link to clipboard

Copied

LATEST

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2016 Oct 18, 2016

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!!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines