ALB Posted July 27, 2011 Share Posted July 27, 2011 I have to change some layers name (eg. layers visibile) adding a prefix string. This is my scipt: Procedure prefix_layer_name; VAR stringa, nomelayer,nuovonome:STRING; h:HANDLE; visib:BOOLEAN; BEGIN stringa:=StrDialog('Prefix', 'AAAA001' ); h:=FLayer; While h<>NIL DO BEGIN IF GetLVis(h)=1 THEN BEGIN; nomelayer:=GetLName(h); nuovonome:=CONCAT(stringa,' ',nomelayer); { =====MISSING FUNCTION TO SET A NEW NAME======== } END; h:=NextLayer(h); END; END; RUN (prefix_layer_name); Best regards. Quote Link to comment
maarten. Posted July 27, 2011 Share Posted July 27, 2011 SetName(h,'name for the layer'); Quote Link to comment
ALB Posted July 27, 2011 Author Share Posted July 27, 2011 Thank you... but it doesn't work! It's just for objects. In VS Function Reference I've found this: Function GetName returns the object name of the referenced object. The function returns None if the object has no object name. A handle to layer may not passed to this routine; to obtain a layer name, use GetLName. ...however SetLName(h,namelayer) doesn't exist! Quote Link to comment
maarten. Posted July 27, 2011 Share Posted July 27, 2011 GetName Doesn't work indeed, that's because the Layers aren't part of the NameList (and GetName use that list). But SetName should work. Have you tried SetName? It works fine here... Quote Link to comment
ALB Posted July 28, 2011 Author Share Posted July 28, 2011 GetName Doesn't work indeed, that's because the Layers aren't part of the NameList (and GetName use that list). But SetName should work. Have you tried SetName? It works fine here... Yes, you're right! Thank you very much! My mistake was GetLVis(h)=1. Possible values are: Normal 0 Grayed 2 Invisible -1 This is my final script: Procedure prefix_visible_layer_names; VAR stringa, layer_name,new_name:STRING; h:HANDLE; BEGIN stringa:=StrDialog('Prefix string', '001.A' ); h:=FLayer; While h<>NIL DO BEGIN IF GetLVis(h)=0 THEN BEGIN; layer_name:=GetLName(h); new_name:=CONCAT(stringa,' ',layer_name); SetName(h,new_name); END; h:=NextLayer(h); END; END; RUN (prefix_visible_layer_names); 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.