Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save itfrombit/821502 to your computer and use it in GitHub Desktop.

Select an option

Save itfrombit/821502 to your computer and use it in GitHub Desktop.
var path = "/Users/jsb/Desktop/LayerTest";
var filename = "jefftest.acorn";
var acorn = JSTalk.application("Acorn");
var doc = acorn.open(path + "/" + filename);
var count = doc.layers().count();
for (i = 0; i < count; i++)
{
doc.layers()[i].visible = NO;
}
for (i = 0; i < count; i++)
{
if (i > 0)
doc.layers()[i-1].visible = NO;
doc.layers()[i].visible = YES;
doc.dataOfType("public.png").writeToFile(path + "/layer" + i + ".png");
}
doc.close();
@itfrombit

Copy link
Copy Markdown
Author

No, that was just sloppy code. You don't actually have to duplicate the document at all. Here's an updated version that's a little cleaner.

@haikusw

haikusw commented Feb 13, 2011

Copy link
Copy Markdown

ok!. wondered about that. thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment