ZBrushCentral

Multiple Script.txt Loading

I am trying to load multiple scripts to compile at startup.
They must be .txt’s so I can convert them to .zsc’s I have
Script01.txt
Script02.txt
Script03.txt

I also have a file with their paths in them.

Files.txt which contains the paths to these scripts.
Like so:
C:/pathToScript/Script01.txt
C:/pathToScript/Script02.txt
C:/pathToScript/Script03.txt

Now I want to compile each script when I press a script button.

ZBrush will not compile all of them, it loads each one in my loop, but only the last one gets compiled to a zsc.

Here are my steps.... I am loading memory from file (Files.txt), then I am reading string from memory (using end of line)... this works because I am testing it with a [Note,fileName] Command. Then I am setting [FileNameSetNext,fileName]and using [ISet, ZScript:Load,1] to load the script. It seems like I need a stall in there, I will try the sleep command and see if it helps, but usually this works on the thread, so I doubt that it will work.

It loads All the Scripts, but only compiles the last one in the list. I really need a way to compile multiple versions of the scripts.

Anyone have any Ideas?

I will try to make 2 separate scripts do the actions, maybe I can control this by reloading the main script??? I’ll give it a shot…

Hi Chris,

Two things… Maybe try [IPress,ZSCRIPT:Load ] instead. I’ve found cases where the ISet command doesn’t do the same thing as the IPress command.

The other thing is the Delay command. Not sure if you’ve tried that or not.

If you get this solved, could you post the solution?

Thanks.

Sven

IPress actually stops a loop or sequence of presses for some reason. (Havn’t looked up the def in the ZScripDocs yet).

Delay doesn’t seem to do it either. Thanks for the help though.

I will probably have to call a dll for this one. I will try a few more things, but I don’t feel very confident about this one. I wish we could get something like my earlier post about this:

Thanks again, Chris

Well, I have tried every command I can see in the scripting docs. Nothing works. I tested using a dll and it works very well. I just have to quickly simulate button clicks into a specified area.
So it goes like this.

1. On Script Load
2. CreateMemory
3. write interface button position & width to file.
4. DeleteMemory
2-4 could be substitued for FileExecute and pass mem, but I need to do some asyncronous activies here so I opted for the file method.
5. fileExecute to a dll. Creates its own thread/Timer.
6. Dll reads File, uses x,y,w,h info in file plus it gets the window handle of ZBrush and calculates the button position bases on this
data.
7. Simulates button clicks on screen @ 1/10 sec intervals.

Voila…

Not a very nice work around, but it works none the less. Hopefully someone has a better answer, but for now this is working. The nice thing is that I can then use the dll to change/delete/copy the file/s as needed. Chris Reid

Found it to be more accurate if you give your script a keyCommand and simulate a keystroke in the dll.

REASONS:
The position may vary (if you have a button dragged onto the main work area), And your button may not be visible.

The keystroke should remain constant, and you can send it directly to the ZBrush window once you have the window Handle.
Plus you can skip the creating and writing memory block to file, unless you need the file for something else.

Works great,
In fact I was doing it at 1/50 sec intervals. Backed it off to 1/8 to keep it stable. I may actually use the file for syncronization, but I havn’t run into any problems yet… (where is the cross fingers Smiley when you need it ;?)

Chris Reid