Skip to main content
Legend
June 6, 2022
Question

InDesign server - preflight error

  • June 6, 2022
  • 1 reply
  • 836 views

Hi,

I have a error with saveReport function ...

 

[javascript] Exécution du fichier : /Applications/Adobe InDesign Server 2021/Scripts/preflight/ExportPreflightReport.jsx
[serveur] Error: Valeur incorrecte pour le paramètre 'openOption' de la méthode 'open'. OpenOptions enumerator attendu(e), mais FALSE reçu(e).

 

Snippet of my code

 

var mErrorFolder = Folder(mSwypBoxErrorFolder.fsName.concat('/',_CODE_PUBLICATION,'/',mNomenclature,'/'));
FOLDER_create (mErrorFolder);
var mDocName = d.name.split('.indd')[0];
mPreflightProcess.saveReport(File(''.concat(mErrorFolder ,'/','#erreur_', mDocName,'.pdf')));

 

No error with InDesign CC 2021 Desktop ...

 

ExportPreflightReport.jsx files are the same in /Applications/Adobe InDesign 2021/Scripts/Preflight and /Applications/Adobe InDesign Server 2021/Scripts/Preflight

Thanks for your help
Ronald

This topic has been closed for replies.

1 reply

BarlaeDC
Community Expert
Community Expert
June 7, 2022

Hi,

 

Are you able to share the whole code as I don't think that error has to do with the snippet you posted?

Ronald63Author
Legend
June 7, 2022

Hi,

I think my code is not the source of the problem because the same script works with InDesign CC2021 desktop.
I suspect the ExportPreflightReport.jsx file is the cause of the problem ...

However here is all the code of the PREFLIGHT function

    var a = [];
    preflightFlag = false;
    var co,d,f,flag0,folio,ind0,ind1,m,n,p,rub0,rub1,s;

    c0 = mXMLdata.xpath('count(//*/PAGE)'); // count page node
    if (c0){
        /*===========*/
        /* PREFLIGHT */
        /*===========*/
        for (var i = 1; i <= c0; i++) {
            flag0 = true;
            
            rub1 = STR_normalize(mXMLdata.xpath('//*/PAGE[position()=' + i + ']/@rubrique').toString());
            ind1 = mXMLdata.xpath('//*/PAGE[position()=' + i + ']/@nom');
            if (i > 1){
                rub0 = STR_normalize(mXMLdata.xpath('//*/PAGE[position()=' + (i-1) + ']/@rubrique').toString());
                ind0 = mXMLdata.xpath('//*/PAGE[position()=' + (i-1) + ']/@nom');
                if (ind0 == ind1){
                    flag0 = false;
                }
            }

            if (flag0){
                a = [];
                /* open file */
                var mFile =File(mPackageInFolder.fsName.concat('/',ind1));

                app.open(mFile);
                var d = app.documents[0];

                updateAllLinks(d);

                var mDocFolder = Folder(d.filePath.fullName);
                var mPreflightFile = File(_LocalPath.concat('/_production/instance/_assemblage/#profil_idpp#/',_CODE_INSTANCE.toLowerCase(),'.idpp'));
                var mPreFlightName = _CODE_INSTANCE.toLowerCase();
                if (!mPreflightFile.exists){
                    errorMsg = '|'.concat('preflight profil not found','|',mPreFlightName);
                    LOG_error (errorMsg);
                }
           
                /*remove old preflight*/
                if (app.preflightProfiles.item(mPreFlightName) != null){
                    app.preflightProfiles.item(mPreFlightName).remove();
                }
                /*load preflight*/
                app.loadPreflightProfile(mPreflightFile);
                /*create preflight process*/
                var mPreflightProcess = app.preflightProcesses.add(d, app.preflightProfiles.item(mPreFlightName));
                var mWaitProcess = mPreflightProcess.waitForProcess();
                /*check preflight result*/
                if (mPreflightProcess.processResults != 'None'){
                    var errors = mPreflightProcess.aggregatedResults[2];
                    if(errors.length > 0){
                        var mErrorFolder = Folder(mSwypBoxErrorFolder.fsName.concat('/',_CODE_PUBLICATION,'/',mNomenclature,'/'));
                        FOLDER_create (mErrorFolder);
                        var mDocName = d.name.split('.indd')[0];
                        mPreflightProcess.saveReport(File(''.concat(mErrorFolder ,'/','#erreur_', mDocName,'.pdf')));
                        mPreflightProcess.remove();
                        preflightFlag = true;
                        d.save(mPackageInFolder.fsName.concat('/',d.name));
                        d.close (SaveOptions.NO);
                        mFile.copy(mErrorFolder.fsName.concat('/',mDocName,'.indd'));
                    }else{
                        mPreflightProcess.remove();
                        d.save(mPackageInFolder.fsName.concat('/',d.name));
                        d.close (SaveOptions.NO);
                    }
                }else{
                    mPreflightProcess.remove();
                    d.save(mPackageInFolder.fsName.concat('/',d.name));
                    d.close (SaveOptions.NO);
                }
            }
        }
    }else{
        errorMsg = '|'.concat('no page node in xml','|',mNomenclature);
        LOG_error (errorMsg);
    }
BarlaeDC
Community Expert
Community Expert
June 7, 2022

Hi,

 

I notice in your code you have this line

app.open(mFile);

and from the document - https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42253__d1e47649

 

as you are only specifiying the document to open: the actual call would be

app.open(mFile, true, OpenOptions.DEFAULT_VALUE);

which I believe would try and open a window, which I don't think InDesign Server can do, so you might need to make this call

app.open(mFile, false);

I don't have InDesign Server to check, but it might be worth a shot.