Skip to main content
bobbtmann
Participant
June 4, 2018
Answered

Layer properties not being retrieved in Javascript

  • June 4, 2018
  • 1 reply
  • 343 views

I'm writing a javascript to compile a bunch of files together. It works like this:

Get list of files and corresponding list of layers (one layer from each file, if you want multiple layers from the same file, list the file twice)

|

Open up files

|

Get list of top level layers in file and print an alert

|

Find layer with same name as layers and copy contents of layer into a new file

|

Close file

|

Repeat

It works very well when the list of files is small, but when I get to about 4 or 5, something seems to break. When I open up the file, I print the layer array contents and compare it to what I know the layers to be. When the script is about to break, I get something that looks like this:

Where one of the layers doesn't have properties. It hasn't got a name or an array of children layers. It's not the fault of the file, since if I do a short list it works fine. If a run works with a certain number of files, and I duplicate the last set (so the last file/layer combo is repeated) it will fail when it repeats.

Has anyone ever come across a problem like this before, or have an idea about why it is happening?

This topic has been closed for replies.
Correct answer bobbtmann

I solved it!

Turns out the problem arose from opening and closing the files. The solution was to not close any of the files that I had opened.

Still don't know the underlying why of the problem, though.

1 reply

bobbtmann
bobbtmannAuthorCorrect answer
Participant
June 6, 2018

I solved it!

Turns out the problem arose from opening and closing the files. The solution was to not close any of the files that I had opened.

Still don't know the underlying why of the problem, though.