ZBrushCentral

Question : Naming a [Tool:SubTool:New Folder] with a variable

Hi,

I’m wondering, how can I name a “Tool:SubTool:New Folder” with a variable.

I know I can get the name of a Subtool and set my variable this way :

[VarSet,subTName,[IGetTitle, Tool:Subtool:ItemInfo,]]
[VarSet,subTName,[StrExtract,subTName,0,[StrLength,subTName]-2]] 

But I can’t seem to find a way to code the variable in the dialogue box and name the folder after this command :

[IPress,Tool:SubTool:New Folder]	

I’ve tried multiple ways without any luck. I’m hoping someone can help me with my issue.

Thank you very much!

Hi David,

Welcome to ZBC!

It’s not possible to rename a folder using zscript. It can be done but you need to use the ZFileUtils dynamic library which you can find here:
http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/zfileutils/

The function you use is the same as for “Renaming a SubTool”. Having set the variable “dllPath” to the path to the ZFileUtils libary file (as explained on that page) you would call this routine in your zscript:

//routine to rename a folder
[RoutineDef,NameFolder,	
  [VarSet,buttonPath,"Tool:SubTool:New Folder"]  
  [If, (([IExists, buttonPath]) && ([IsEnabled, buttonPath])),
		[FileExecute, [Var, dllPath], RenameSetNext, nameStr]	
		[IPress, buttonPath]
  ]	
,nameStr]

//call the routine like this:
[RoutineCall,NameFolder,"My New Folder"]

I hope this helps,
Marcus

Hey Marcus,

Thank you for the welcoming words. I really appreciate you took the time to answer my question and others. Your input helped me a lot with my problem and learn about Zscript.

Thank you,
David

1 Like