Pat Stanford Posted February 29, 2012 Share Posted February 29, 2012 A members of the Los Angeles users group requested a way to sort the layers in a file. The attached script does exactly that. Procedure SortLayers; {Sorts Layers into Alphabetical Order} {Very Lightly Tested. Save File Before Using} {It is the users responibility to maintain a current backup before using this script} {Use at your own risk.} {February 28, 2012} {? 2012, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} Type LayerStruct = Structure LayerName: String; LayerHandle: Handle; End; Var MyLayer: Handle; MyName: String; MyCount: Integer; MyArray: DYNARRAY of LayerStruct; ArrayCount: Integer; LoopCount: Integer; Begin MyCount:=NumLayers; Allocate MyArray[1..Mycount]; MyLayer:=FLayer; ArrayCount:=1; While MyLayer <> Nil do Begin MyArray[ArrayCount].LayerName:=GetLName(MyLayer); MyArray[ArrayCount].LayerHandle:=MyLayer; ArrayCount:=ArrayCount+1; MyLayer:=NextLayer(MyLayer); End; ArrayCount:=ArrayCount-1; SortArray(MyArray,ArrayCount,1); For LoopCount := ArrayCount downto 1 do Begin MyLayer:=MyArray[LoopCount].LayerHandle; HMoveForward(MyLayer,True); End; End; Run(SortLayers); Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.