Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Major issues with PARM error, Adobe doesn't support JavaScript engine

$
0
0

I'd really appreciate it if people in the community could see if my test script produces the PARM error consistently on their installs of Illustrator and if anyone could spot some problem that might explain why the error occurs.

 

I'm really stuck with constant PARM errors popping up at random times through my application. After the error occurs Illustrator has to be exited and restarted otherwise it'll always error out on every JavaScript execution.

 

Basically, I have a big application that interfaces with Adobe by  mapping buttons in an application to javascripts. Its practically  unusable.due to the PARM errors.

 

It's something like "an Illustrator error occurred: 1346458189 ('PARM')"

 

I can reproduce the error with a cut down script but can't find anything wrong in what I'm doing. Adobe won't even look at the script where I can reproduce the error even on a paid support incident. According to Adobe they don't support javascript even though it's the JavaScript engine in Illustrator that's crashing.

 

I'm using Adobe CS5 (15.0.2 currently) in a Windows environment. Generally I'm testing in Windows 7 64-bit but Windows XP 32 bit has the same issue.

 

Hopefully someone can spot something I've just been doing wrong because I can't. If it's a bug then I'm out of luck since I can't even talk to anyone to report it.

 

I was able to create a simple example where a couple of groupItems are copied from an open document and pasted to a new document, moved to a specific group, and then removed. In reality there would be lots of formatting on the new document before the group is removed but it crashes even without doing all of that.

 

Here is a zip with the test script and the test document. Just open the testScript.jsx in ExtendScript Tool Kit and open testdocument.ai in Adobe Illustrator. Execute the script and it tells you how many times the test ran before it errored out. Generally this happens for me in less than 10 iterations of the test but occasionally it won't error out after 100 runs.

 

testLayout.zip on DropBox

 

Here's the test script itself in case someone can spot something obvious.

 

#target Illustrator

 

function createLayout(names) {
    var intResult = 1;

 

    var docPreset = new DocumentPreset;
    docPreset.units = RulerUnits.Inches;
    docPreset.width = 612.0;
    docPreset.height = 792.0;
    docPreset.title = "Test Document";
    docPreset.colorMode = DocumentColorSpace.CMYK;
   
    var doc = app.activeDocument;
    doc.selection = null;
     
    try {
        var printDoc = app.documents.addDocument(DocumentColorSpace.CMYK,docPreset);

 

        app.activeDocument = printDoc;
        var layerArt = printDoc.layers[0];
        layerArt.name = 'artwork';
        printDoc.activeLayer = layerArt;
        var grpSource = layerArt.groupItems.add();
        grpSource.name = 'source';
        app.activeDocument = doc;
        for(var i = 0;i < names.length;i++) {
            var layerSections = doc.layers['section' + names[i]];
            var grpSection = layerSections.groupItems[0];
            grpSection.selected = true;
        }

 

        copy();

 

        app.activeDocument = printDoc;
        printDoc.activeLayer = layerArt;
       
        paste();
       
        printDoc.selection = null;

 

        for(var i = layerArt.pageItems.length - 1; i >= 0;i--) {
            var grp = layerArt.pageItems[i];
            if(grp.name != 'source') {
               var  box = grp.pathItems['bgbox'];
                box.height = box.height - 18.0;
                box.position = [box.position[0],box.position[1] - 9.0];
                // Omitting the move of pasted group into destination group avoids PARM error
                grp.move(grpSource,ElementPlacement.PLACEATBEGINNING);
            }   
        }

       //  Commenting out the remove line and setting the hidden property seems less likely to cause a PARM error
       grpSource.remove();
       //grpSource.hidden = true;

 

       app.redraw();

 

       printDoc.close(SaveOptions.DONOTSAVECHANGES);
      
       intResult = 0;
       app.activeDocument = doc;

 

    }
    catch(e) {
        alert('error:\n' + e);
        intResult = 1;
    }
    return intResult;
}

 

function main() {
    var names = ['Left','Right'];

 

    var counter = 0;
    var result = 0;
    while (counter < 100) {
        var result = createLayout(names);
        if (result == 1) {
            alert('script failed after ' + counter + ' runs');
            break;
        }
        counter = counter + 1;
        app.redraw();
    }
    if(result == 0) {
        alert('test produced no errors');
    }
    return result;
}

 

main();

 

As the comments in the script state, if I set hidden on a group instead of removing it I avoid the PARM error. If I don't move the pasted groups into the group that will be removed it doesn't crash either. However, for a test I can do this but it doesn't explain why it causes the error. I can look at rewriting parts of my many scripts to not remove any groups but I don't know that it would be effective. I tried another test where I just created objects from a new document only, moved them around, deleted them, etc. but couldn't get the PARM error to pop up just from doing that.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>