Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save itfrombit/821502 to your computer and use it in GitHub Desktop.
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
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
Copy link

haikusw commented Feb 13, 2011

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