an Illustrator error occurred: 1346458189 ('PARM')

New Here ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

Hello everyone,

I am trying to open some documents in Illustrator CS4 by javascript, walk through all layers including sublayers, doing something (for now just reading the layernames and showing them at an alert), closing the document and continue with the next document in the given folder until all documents in that folder are done.

By doing so I found an error I never have seen so far and I cant figure out where it comes from exactly to get rid of it.

The Error an Illustrator error occurred: 1346458189 ('PARM') appears randomly when cycling through the layers of the document but only every second document, so I guess there might be something wrong with closing a document and realeasing all references but I could not figure out what.

Maybe someone got an idea on this problem? Posting my sourcecode (just a simple test-code) below.

#target illustrator

var sourceFolderPath = "/e/TestAI";

var destinationFolderPath = "/e/TestZielverzeichnis";

var fileNameDefinition = "*.ai";

var sourceFolder = new Folder(sourceFolderPath);

var destinationFolder = new Folder(destinationFolderPath);

runCheckTool();

function runCheckTool() {

var contentInput = sourceFolder.getFiles(fileNameDefinition);

var fileRef;

var docRef;

for (var i = 0; i < contentInput.length; i++) {

fileRef = null;

docRef = null;

try {

fileRef = new File(contentInput);

docRef = open(fileRef);

} catch(e) {

alert("# 1: " + e);

}

try{

checkLayers(docRef.layers);

} catch(e) {

alert("# 2: " + i + " " + e);

}

try {

docRef.close(SaveOptions.DONOTSAVECHANGES);

alert("end file index: " + i);

} catch(e) {

alert("#3: " + e);

}

}

}

function checkLayers(layerRef) {

var countLayers = layerRef.length;

for (var j = countLayers - 1; j >= 0; j--) {

if(layerRef.layers.length > 0) {

checkLayers(layerRef.layers);

}

alert ("Layer: " + layerRef.name);

}

}

Screenshot001.png

TOPICS
Scripting

Views

17.9K

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 ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

I've had this error number several times… Im still not sure what its down to (most likely my code I thinks). Does ESTK not give you any more indications than that dialog? I last got this error only last week when making a variable to a collection of objects then moving some where the reference to the index becomes broken. Your layer check worked without issue when repeatedly run with just an active doc…

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
New Here ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

Hello,

yes, the layer check runs without problems when executed on an active document.

And no, no more information. This is all I get by just showing the catched error as you can see I just pipe the error message into a alert window to show it.

The Problem seems to occur somehow when I closed a document by the document.close(DONOTSAVECHANGES) function and then run the layer check on an other (or reopend the same) document. When I close the document manually and run the check again its no problem so I guess there is an issue with the closing of the document.

But I got no further clue and well, I need to be able to close the document as well as the script shall run on a few thousend documents for the next few years (some kind of server solution for mass document manipulation). Its also no solution to restart Illustrator after each run as that would take way to long.

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 ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

It seems to be loosing track of which is the current document. It might help to define it.

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 ,
Nov 07, 2010 Nov 07, 2010

Copy link to clipboard

Copied

I would try and change a few things as I don't think you require all that you have included. Why not just…

var sourceFolder = new Folder("/e/TestAI");

var destinationFolder = new Folder("/e/TestZielverzeichnis");

var contentInput = sourceFolder.getFiles("*.ai");

The built-in function .getFiles() returns an array of file objects so there is NO need to make an additional file reference with…

fileRef = new File(contentInput);

As you have passed a mask as a parameter you need not worry about folders and other unopenables… Just…

var docRef = open(contentInput);

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
New Here ,
Nov 07, 2010 Nov 07, 2010

Copy link to clipboard

Copied

Hello Muppet Mark,

thanks for your reply.

As you suggested I skiped the not needed variables and stuff for this simplified testscript but unfortunately its not solving the problem. Still getting the error on every second file.

Seems to me there is something in the cach or where ever stored over the run and the close of one file so its still somehow referenced.

Does there is a way to clear all storage or stuff like that?

Over all I dont understand why its occuring on a random step inside the checkLayers function.

The fact that it is working correctly when I close the files manually in Illustrator is wondering me as well and leads to the guess that there is something wrong with the docRef.close call. Does there is an other or further function I should use to "completely" close a document?

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 ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

Jens, I've ran a little test at this end and I can't find any issues with this at all… I dropped the try statements and just wrote the info back to the ESTK console…

#target illustrator var sourceFolder = new Folder("~/Desktop/TestAI"); var destinationFolder = new Folder("~/Desktop/TestZielverzeichnis"); runCheckTool(); function runCheckTool() {      var contentInput = sourceFolder.getFiles("*.ai");      for (var i = 0; i < contentInput.length; i++) {           docRef = open(contentInput);           $.writeln(docRef.name+" Layers:\r\r");                      checkLayers(docRef.layers);                      $.writeln("\r\r");           docRef.close(SaveOptions.DONOTSAVECHANGES);      } } function checkLayers(layerRef) {      var countLayers = layerRef.length;            for (var j = countLayers - 1; j >= 0; j--) {                 if(layerRef.layers.length > 0) {                           checkLayers(layerRef.layers);                           }                 $.writeln("Layer: " + layerRef.name);            } }

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
New Here ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

Hello Muppet Mark,

I have tested the script with your changes (just skiped the destination folder as its not needed for this test) and the result is always the same, at the second file at an random point while runing through the layers the script stops with the error message.

I also tested it on a second PC to ensure that its not a setting on my development PC.

Attatched you will see a screenshot with the output and the error message in the buttom line of the ExtendedScript ToolKit. The second file has been worked through some steps (some layers are shown in the outupt).

The two files I used for testing are all the same, I just renamed the layers of the second one (which is a copy of the first one) to make a difference visible.

Screenshot003.png

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 ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

I am NOT able to replicate this error at my end the script just runs thru the files as I would have expected… The files in my test were just empty dummies with a bunch of blank layers… I will go chuck a bunch of junk in the mix and see what gives…

Picture 1.png

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 ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

Jens, I got the files while out at lunch. I have added them to my test folder and again NO issues… It ran much as the rest. The result is what I would have expected. Your Function does work in reverse order but I expect that was you intention…

Picture 2.png

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
New Here ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

Hello Mark,

thanks for all your effort.

At least, it shows that the code I wrote and my thinking was not so wrong 😉

And yes, its been my intention to cycle through the layers in reverse order.

Well, as I got the same problem here on two different PCs and with two different Illustrator versions I will try to run an illustrator installation on an virtual machine next so I can try it outside of our comanies network and basic settings. Other than that ... I ran out of ideas ...

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
New Here ,
Nov 09, 2010 Nov 09, 2010

Copy link to clipboard

Copied

Hello again,

I have tested now on a virtual machine and well, its working just fine.

Means the problem seems to be something in between Illustrator and the companies software distributon system as its only occuring here.

I still dont know what the exact problem might be and how to avoid or solve it but I can work on a virtual machine so it will work just fine.

Thanks again for all your effort, you helped me a lot getting to this solution

We will see again on my next question, some day

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 ,
Oct 26, 2014 Oct 26, 2014

Copy link to clipboard

Copied

I have been getting this error only since latest CC2014 update.

this is with scripts that have never thrown errors before.

And as i run scripts from actions,(this is not persistent on restart for those who don't know).

I often do not restart illustrator for over a week.

Never seen this error.

Now since updating I get it after around 4 hours of work.

and it seems to be random.

I can run the same script on the same file over and over again and will get errors on different lines of code.

then it will stop for a time.

I have added Alerts to the code to try to find what is happening.

one script cycles through textItems looking for a particular string.

I can trace it to a text item that is causing the error.

and have it error at that point on running script ten times.

then it will free up and it will accept that textItem again and not error.

It has me very confused!

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
Engaged ,
Oct 26, 2014 Oct 26, 2014

Copy link to clipboard

Copied

For my script, someone suggested looping backwards through the layers, which worked perfectly, no errors.

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 ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

I'll give that a go.

The script causing the most errors does use a forward loop.

I'll post back whit the results.

thanks.

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
Engaged ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

Good luck! The issue with mine, was that I was moving layers based on their zOrder, which changed everytime I pulled a layer out, looping backward allowed me to be sure I wasn't trying to find a non existent layer.

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 ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

mine just puts contents into a variable.

this is used for building filename prior to save.

text = app.activeDocument.textFrames.contents;

so back or forward should make no difference.

and the fact it errors sometimes and not other times on the same textFrame in the same file makes me think its a problem with the scripting engine.

But will see if it helps

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 ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

Still getting the same error.

see image below:

error.JPG

close the doc, reopen and its working again.

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
Engaged ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

Did you try the solution in the read me I posted? Didn't work for me, but I had other issues.

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 ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

I might go back through the script and give it a rewrite.

I wrote it years ago and though its never caused this issue before, does not mean its an elegantly written script...

I can see some obvious ways of cleaning it up, and may find some rookie error I made all those years back when re-writing it.

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 ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

it may very well be the new engine, with every new release something gets broken.

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
Community Beginner ,
Nov 29, 2010 Nov 29, 2010

Copy link to clipboard

Copied

Hey Jens,

I'm doing a lot of batch processing and I also received the PARM-error, but I found a solution to it:

Before you run your script, press the TAB-key. That's it.

It will remove all illustrator panels and my guess is that the panels try to keep up with the changes your script is doing, but when they're not visible they don't. And that freed me from my PARM-error. Hope it will do the same for you!

/Fredrik

www.borgstrom.biz

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
New Here ,
Nov 29, 2010 Nov 29, 2010

Copy link to clipboard

Copied

Hello Fredrik,

unfortunatly this solution is not working with my error. I tested it out some time ago and it still appears.

Further on our scripts shall run on a server (doing some quality checks on input files mainly) so they have to run without user interaction.

As far as our development on this term has gone we are going to handle the opening and closing of documents by C# as well as the rest of the filehandling and just doing the quality check inside illustrator (and photoshop) with JavaScript.

But thanks for your answer.

Regards,

Jens

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
Community Beginner ,
Nov 30, 2010 Nov 30, 2010

Copy link to clipboard

Copied

I'm sorry to hear that it didn't help. You know, there might have been some other changes that I did to my code that in combination with the TAB-trick made things work. But I know I was struggling a lot with that PARM-error. I feel pretty certain that it's due to problems of making the javascript interpretator run in parallel with the illustrator GUI. And I know for certain that removing all GUI-panels was the thing that finally made things work for me.

I would try any measure possible to alleviate the workload on the illustrator application. And you can replicate the TAB-trick by closing all panels and saving it as a workspace. That way, whenever illustrator starts it will use your most recently selected workspace and you can have an environment that automatically starts up without any panels.

Because I remember taring my hair off for over a week with the PARM-error. And no matter how much I tried to correct my code, it would appear. But when it appeared at random times and with random files it made me suspect there were problems with the javascript runtime.

Btw, my code does quite heavy and extensie processing of printing templates in order to enable the creation of swf-files for an online editor as well as pdf-files that will be used for creating the final printing proofs based on the user-edited swf-files.

BUT, any working solution is a good one, so if you managed to get things running using C#, go for it!

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
New Here ,
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

I've been debugging a script that gives me the same error if I close a file before moving to the next one. If I comment out the closing and leave all the files open then it works fine. When I use the debugger and step through the code I can see my array of layers that the script collects will sometimes have a bad layer which causes the crash because it has no layer properties or methods and I'm trying to use them. Illustrator has been the most frustrating adobe product for me to script for hands down.

James

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