Problems with Javascript on Mac, but not PC

I run into some strange problems with a script in which Mac another user stops on a line nothing stores more than one State of history to the variable "actHist" while PC to run the script very well.  We will test the script one Mac to another later today, but I was wondering if there are any known issues with running scripts in Java on Mac vs PC database?  Here is a screenshot of the problem:

MacError.png

I can't understand WHY it stops on this area.  I tried of asigning the variable outside of the cause of the else statement that I was out of ideas, but it's the same no matter where I declare it.  The odd part is, that the same line is used elsewhere in the script without problems, it doesn't seem to work in the same place on a Mac (PC has no problems with it).  No idea why this is only a problem for the Mac and not any PC?

Tom's right. It is a known problem and Adobe has been alerted to this topic. This error can also occur when you try to access the activeLayer of a document.

I used this code for embarrassing lines like this and it worked for me:

try {
   doc = app.activeDocument;
} catch  (e) {
   $.sleep(500);
   var desc = new ActionDescriptor();
   desc.putEnumerated(cTID("Stte"), cTID("Stte"), cTID("RdCm"));
   executeAction(cTID("Wait"), desc, DialogModes.NO);

   doc = app.activeDocument;
}

It did not work for others. Someone suggested using the:

   try {
      doc =  app.activeDocument;

   } catch (e) {
      app.refresh();
      doc =  app.activeDocument;
   }

I have not tried because I don't have a reproducible test case.

Tags: Photoshop

Similar Questions

Maybe you are looking for