Setting up a macro to run on startup

It is straightforward to get ZBrush to start the way you want. All you need to do is record a startup macro. You can then edit the DefaultZScript to automatically play the macro when ZBrush launches.

First you need to record your macro:

  1. Before you start recording, make sure to initialize ZBrush by pressing the Init ZBrush button at the top of the Preferences palette. This makes sure ZBrush is cleared of any custom tools and so on which might mean your startup macro doesn’t run correctly.

  2. Press the New Macro button in the Macro palette. When you get the message about initializing ZBrush click Yes. This ensures that your macro will run correctly.

  3. Now set up ZBrush how you want. When you’re done press Macro>End Macro. Save the macro to the ZStartup\Macros\Misc folder and call the file StartupMacro.txt.

You should now have a new button called StartupMacro in the Misc submenu of the Macro palette. If it’s not there press the Reload All Macros button and it should appear.

It’s a good idea to test your macro to see that it runs correctly. Initialize ZBrush first, so that you’re starting from the default state, then press the button.

Changing the DefaultZScript:

Once you have your startup macro recorded you need to edit the DefaultZScript so that your macro is run automatically on startup. If you’ve followed my instructions exactly you can simply copy the attached file:

1.In the ZBrush 3.5 R3/ZScripts folder you’ll find a file called DefaultZScript.txt. Rename this DefaultZScript_bak.txt. This is so that you can restore the original start up if you want.

2.Put the attached DefaultZScript.txt in the ZBrush 3.5 R3/ZScripts folder.

  1. Restart ZBrush.

More detail - for those interested

All this edited DefaultZScript is doing is executing a bit of code that presses the macro button. It’s important that the code is correct and the macro button is actually there or the code will fail. If you get an error message saying that the interface item can’t be found then you’ll know you’ve made a mistake somewhere.

The full (revised) DefaultZScript code is below. The important bit is the IPress command. (It’s wrapped in an If statement because it is not a top level command and so can’t exist on its own.)

[If,1,
	[IPress,Macro:Macros:Misc:StartupMacro]
]
[pd]

The code after IPress, is the button path. You can find this for any ZBrush button by holding Ctrl while the cursor is over the button. The button path will be shown at the bottom of the pop-up window.DefaultZScript.txt (65 Bytes)

1 Like

thanks, i knew there was a easy way to set this up.

Sorry for digging up this old thread…
Is there any way to start ZB with the star shape instead of the sphere?

Record a macro which load the star (PolyMesh3D) and load this Macro like explain above.

Thank you, it’s working now :smiley: :smiley:

I m also using it yups its working fine when i use it first time. Thanks for sharing this useful and helping information. :-1:small_orange_diamond:+1:small_orange_diamond:-1:

is this still valid for zbrush 4r4?

Yes, it should work OK.

thanks, seems to work :slight_smile:

Hi,

I have a startup macro that loads a default Dynawax Zproject. I first initialized Zbrush -> ‘New Macro’ -> (Init again) -> load my ZProject -> Choose a MatCap -> ‘End Macro’ -> Save “StartupMacro.txt”.

Everytime when I startup ZB4r4 I get this dialog box (see attached jpg). Is there a way to disable this message on startup, or should I record my startup macro some other way? Also, I would like to turn of the Spotlight menu on startup. Is that possible?

Thanks!

/ Tennet

zb_4r4_startup_03.jpgzb_4r4_startup_02.jpg

Can you post the whole macro so I can take a look (just attach the text file to the post)? It might need editing.

Provided you have the latest version of ZBrush 4R4 (P2) then you can turn off Lightbox showing at startup. Simply turn off Preferences>Lightbox>Open At Launch and then save the configuration (Shift+Ctrl+i).

Do you have ZB 4R4 P2?

Yes, I am using 4R4 P2, so Lightbox has now been disabled on startup. Thanks!

Attached is my StartupMacro.txt. Hope it is possible to get rid of the “save changes dialog” on startup also. Thanks again.

StartupMacro.TXT (302 Bytes)StartupMacro.TXT (302 Bytes)

Thanks. This seems to be an issue with the default zscript, not the macro. The default zscript is running twice for some reason. To stop it, open the ZBrush 4R4/ZScripts/DefaultZScript.txt file in a text editor and replace the contents with this code:


//startup
[If,[MemGetSize,startup_mem],,
   [MVarDef,startup_mem,1,0]
   [IPress,Macro:Macros:Misc:StartupTest]	
]
[pd]

Let me know if this does the trick.

Thanks Marcus,

Your code did the trick. I just had to edit the line “[IPress,Macro:Macros:Misc:StartupTest]” with the name of my macro “StartupMacro”. Now it works, no more startup dialogs. Thanks again!

/ Frederik

Oops, forgot to change that! Anyway, I’m glad you got it working. :slight_smile:

I might be late, but I have a startup macro supposed to set up brush preferences (like changing the default intensity, setting up a material, etc.) When I start ZBrush, it looks like that some action doesn’t happen (like alpha set to 28, etc. . So each time I had to run the macro manually, and then it’s OK. I duplicated the lines in the startupcode, and it seems that now it’s a bit more precise…
It is also a common issue, that the standard brush is adjusted, though I don’t tough it in my script.

Any help?StartUpMacro.TXT (919 Bytes)

Hi Jester,
Apologies for the delay in replying. I think part of the problem is that when ZBrush launches it does not have a mesh in Edit mode. This causes problems with the way the brush options are set. I experimented writing a macro that avoids this issue but it still didn’t set the brushes correctly.

What I suggest you do is to adjust your brushes how you want and then re-save them to the ZBrush 4R5\ZData\BrushPresets\ folder. Save them with their original names (ZBrush will automatically add a 1 to the end, so take this off) but make sure you back up the originals, or the whole BrushPresets folder, to another location before you start. That way you can restore the folder to its ‘factory’ state if you need to.

Your startup macro will then only need to set the material, Wax Preview and turn off Spotlight Projection. I have edited the macro for you and attach to this post.

A further note: I have not set the macro to select the ClayTubes brush as the default brush (instead of the Standard brush). The reason is that it will lose its alpha if it is selected when there is no model in edit mode.

StartUpMacro.TXT (403 Bytes)

HTH,StartUpMacro.TXT (403 Bytes)

Thanks Marcus, awesome explanation! I’ll check immediately!

So - I posted this in the ZScripting forum a few days back and didn’t get a reply - I figured I’d post it here as it isn’t really a ZScripting problem as such anyway and somebody might be able to help out.

I’ve been trying to setup a Startup Macro on my new work computer to define the startup material, brushes and brush settings but am having a bit of a problem in that it seems that a portion of the macro runs twice upon starting ZBrush. The startup macro does work and sets everything as I want but it runs through drawing the 3D object and then defining the brushes from there twice.

The Startup macro looks like this:

//ZBRUSH MACRO - Recorded in ZBrush version 4.5
[IButton,???,"Press to run this macro. Macros can be aborted by pressing the ëescí key.",
[IShowActions,0]
[IConfig,4.5]
[IPress,Material:MatCap Red Wax]
[IPress,Material:Skin]
[IPress,Tool:PolyMesh3D]
[CanvasStroke,(ZObjStrokeV02n74=H2CDV21CH2CDV21BH2CEV21CH2CFV21FH2D0V222H2D2V229H2D3V22FH2D3V236H2D5V23DH2D5V246H2D5V24CH2D6V253H2D7V25BH2D7V261H2D8V267H2D8V26DH2D8V271H2D8V275H2D9V27AH2D9V27FH2D9V285H2D9V28AH2DAV28EH2DBV295H2DBV299H2DCV29DH2DEV2A3H2DFV2A8H2E0V2ACH2E1V2AFH2E2V2B4H2E3V2B7H2E3V2B9H2E5V2BDH2E6V2C0H2E6V2C4H2E7V2C7H2E7V2CAH2E8V2CFH2E9V2D4H2EAV2D9H2EAV2DDH2EBV2E2H2ECV2E6H2EDV2EAH2EDV2EFH2EDV2F2H2EDV2F6H2EDV2FAH2EDV2FDH2EEV302H2EEV305H2EFV308H2EFV30AH2F1V30DH2F1V30FH2F2V312H2F3V315H2F4V318H2F5V31AH2F5V31DH2F7V31FH2F8V322H2FAV325H2FCV327H2FDV329H2FFV32CH300V32EH302V32FH302V330H303V330H304V330H305V330H305V330)]
[IPress,Transform: Edit]
[IPress,Stroke:Dots]
[IPress,Stroke:FreeHand]
[IUnPress,Stroke:LazyMouse]
[IPress,Alpha:Alpha Off]
[IPress,Alpha:Alpha 01]
[IKeyPress,SHIFT,[IPress,Stroke:Dots]]
[IKeyPress,SHIFT,[IPress,Stroke:FreeHand]]
[IKeyPress,SHIFT,[IPress,Alpha:Alpha Off]]
[IKeyPress,SHIFT,[IPress,Alpha:Alpha 01]]
[ISet,Draw:Focal Shift,0]
[IPress,Document:New Document]
]

I read that changing the brush settings and then saving over the default brush would get around me having to define them in a startup macro but every time I try and save over a default brush, ZBrush crashes on startup.

Anybody have any ideas what is going wrong or how to remedy this?