ZBrushCentral

SUB Folder

i have a TXT Zscript in 1 folder
then i have another SUB Folder in side my main folder with another txt Zscript
can 1 zscript recall the other txt zscript in a sub folder:rolleyes:

if you tell me i will give you a cookie :slight_smile:

hi cookie monster,

somewhere, I believe, davey actually posted a way to do this to Svengali or digits or maybe even Cameyo. A quick search on Davey’s name should yield a ton of useful zscripting info…and might even answer your previous question.

been racking my brain cuz I know i have seen the solution to your previous post but can’t remember if it was within the zscript commands or within a post here somewhere. I will keep thinking on it and hopefully it will come to me…either in sample script form or in a link. arrrrggghhhhhhh. I feel your frustration buddy!!:wink:

There are basically two ways to do this, depending on what you want to do.

You can use the FileNameSetNext command like this:

[FileNameSetNext,“folder\script.txt”]
[IPress,ZScript:Load]

where ‘folder’ is a subfolder of the folder where your main script resides and ‘script.txt’ is the ZScript you want to load. This will exit the first script when it loads the new one.

Or you can use the zscriptinsert command:

<zscriptinsert,“folder\script.txt”>

Note that this doesn’t use square brackets. It’s not really a zscript command at all but acts like a ‘cut and paste’ to put the whole of another script at that point. This doesn’t exit the first script.

Check out this little example which shows how both methods work. Load the ‘text.txt’ zcsript.

HTH,
Marcus

In addition to what Marcus wrote and to clarify for others reading this thread:

Whenever you supply a filename to a relevant Zscript command Zbrush assumes the file is in the current Zscript’s directory. i.e "SwitchVisibility.txt" is assumed to lie in the same directory as the current Zscript.

If you add folder names to the filename it is assumed those folders lie inside the current Zscript's directory. i.e "[color=Blue]Extra\Functions\SwitchVisibility.txt" assumes that the current Zscript's directory contains an Extra folder and within that a Functions folder which contains the SwitchVisibility.txt file.

If you add a backspace command to the filename it is assumed the file is one directory below the current Zscript’s directory. i.e "\SwitchVisibility.txt" is assumed to lie one directory below the current Zscript’s. "…\SwitchVisibility.txt" indicates the file lies two directories below the current Zscript’s directory, and so on.

You can combine the backspace command with a directory name to go back one directory and enter another directory from there. i.e "\MyScripts\SwitchVisibility.txt" would go back one directory from the current Zscript’s and look in the MyScripts directory for the file SwitchVisibility.txt.

And finally Davey pointed out a neat way to find the main Zbrush directories. By adding "[color=Blue]ZBRUSH_" to your directory name Zbrush will know where to look for your file no matter where the current Zscript is. i.e "[color=Blue]ZBRUSH_Ztools\MyProjects\SwitchVisibility.txt" will look for the file in the MyProjects directory, which should lie in the Ztools folder. Replace Ztools with your folder of choice from the main Zbrush directory. i.e "[color=Blue]ZBRUSH_Zdata", "[color=Blue]ZBRUSH_Zmaterials", "[color=Blue]ZBRUSH_Zscripts", etc. Hope that helps more than it may confuse.

You should also check the following thread for more info on directories handling and an exception to the above rules, namely the [FileNameAsk,…] command.

[Question: controlling Subdirectory paths in ZScript](http://www.zbrushcentral.com/zbc/showthread.php?t=20494)

Thanks TVeyes for your excellent clarification! :slight_smile:

Marcus

thank you :+1: