ZBrushCentral

Trying to launch a .bat from zbrush

Like title says I’m tryin to launch a bat file with the following code:

[VarSet,appPath,“C:\Windows\System32\cmd.exe”]

//full path to the file to open
[VarSet,fullFilePath,[FileNameResolvePath,“helloWorld.bat”]]
//create memblock for app path
[MemCreate,ZFileUTils_AppPath, 256, 0]
//write app path to memblock
[MemWriteString,ZFileUTils_AppPath,appPath,0]
[VarSet,err,[FileExecute,[Var,dllPath],“LaunchAppWithFile”,#fullFilePath,ZFileUTils_AppPath]]
//delete the memblock as we’ve done with it
[MemDelete,ZFileUTils_AppPath]
//an error
[If,err,[Note,“An error occurred.”,2]]

I can get it to work with opening it with notepad but I cant get it to execute with cmd. Is there any other way of doing it?

Thanks!

You can use the function with just the file path like this:

//full path to the file to open
[VarSet,fullFilePath,[FileNameResolvePath,“helloWorld.bat”]]
[VarSet,err,[FileExecute,[Var,dllPath],"LaunchAppWithFile",#fullFilePath]]

The file will then be opened with the default program. Using this method for a bat file worked for me.

HTH,
Marcus

1 Like

That did indeed work! Thank you so much!

1 Like

Follow up question by the way, is it possible to parse arguments back to zbrush using bat files or any other way?

You can start ZBrush with a file - for example, you could get ZBrush to run a zscript like this:
Start "C:\Program Files\Pixologic\ZBrush 2020\ZScripts\Test.zsc" "C:\Program Files\Pixologic\ZBrush 2020\ZBrush.exe"

But there are no other arguments that ZBrush will parse that I know of.

How does GoZ work for example? Is there a way to see or use the functions in there? Sorry for all the questions, were trying to figure out the best way to connect Zbrush to our own pipeline :slight_smile:

GoZ uses a similar method, but through separate executables and plugins, depending on the application it’s linking to. It uses the GoZ format to export from and import to ZBrush, and the other application would convert from or write to the GoZ files appropriately. If you want to use the GoZ format to you would need to submit a ticket to Support and request the GoZ SDK (there’s an approval process).

But if you didn’t want to go that route you could import into ZBrush by launching it with a zscript (that runs without a button being pressed). For example, the zscript might read a text file which has a list of OBJs which are then imported one after another.

i want to run bat file with passed arguments from zbrush so is it possible?
thank you guys.

hi @tonhai25,
try the [ShellExecute] command.

@facelessmindz Thank you