Created
May 31, 2018 20:04
-
-
Save sonburn/d15c8308af50df194c30ea9523e587bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function sortLayerList(layers,output,reverse) { | |
| var layers = (reverse && reverse == 1) ? layers.reverseObjectEnumerator().allObjects() : layers, | |
| loop = layers.objectEnumerator(), | |
| layer; | |
| while (layer = loop.nextObject()) { | |
| var output = (output) ? output : layer.parentGroup(); | |
| layer.moveToLayer_beforeLayer(output,nil); | |
| } | |
| } | |
| // Sort selected layers, don't change output location, reverse order | |
| sortLayerList(context.selection,nil,1); | |
| // Sort selected layers, change output location, respect order | |
| sortLayerList(context.selection,context.document.currentPage(),0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment