InDesign server - preflight error

Enthusiast ,
Jun 06, 2022 Jun 06, 2022

Copy link to clipboard

Copied

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

TOPICS
Scripting , Server developers

Views

82

Likes

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
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

Hi,

 

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

Likes

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
Enthusiast ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

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

Likes

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
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

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.

Likes

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
Guide ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

Have a look at https://www.indesignjs.de/extendscriptAPI/indesign-server-latest/#Application.html#d1e40869__d1e4548... - the middle parameter "showingWindow" is omitted for the server.

Likes

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
Guide ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

Following up:

 

Note that the quoted "indesign-server-latest" was produced for 2019.

 

The default value for parameters can optionally get specified in ScriptInfo (the resource data that is also used to produce OMV files). So if an argument is omitted (on runtime) it will get taken from the resource. If now that ScriptInfo resource is built for InDesign Desktop rather than for InDesign Server (could be some preprocessor directive wrong), the middle parameter would receive the false rather than the expected enum value.

In that case (plenty speculation) an implementation of the open method that picks up the parameters by position rather than by name would find the true in arguments[1].

Could be something different, e.g. a well meaning developer has homogenized the argument list between Desktop and Server. You'd find out by looking at the actual OMV via ESTK. In that case a versioned script might help, or just providing the parameters as @BarlaeDC suggested. Unfortunately - pardon my limited french - I could not make a sense out of the particular error message.

Likes

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
Enthusiast ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

LATEST

I found this ...

https://community.adobe.com/t5/indesign-discussions/problem-with-save-preflight-report-using-javascr... 

I modified the ExportPreflightReport.jsx file, but without success ...

 

I try 

mPreflightProcess.saveReport(File(''.concat(mErrorFolder ,'/','#erreur_', mDocName,'.pdf')),OpenOptions.FALSE);

mPreflightProcess.saveReport(File(''.concat(mErrorFolder ,'/','#erreur_', mDocName,'.pdf')));

mPreflightProcess.saveReport(File(''.concat(mErrorFolder ,'/','#erreur_', mDocName,'.pdf')),false);

Likes

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