Created
February 10, 2011 22:34
-
-
Save itfrombit/821502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
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
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.