ZBrushCentral

ZFileUtils "GetFileNumber" returning wrong number

Hello!

I have an issue using the “GetFileNumber” command from ZFileUtils.dll that I downloaded from ZBrush Docs
When I use the command on a folder that contains a very large number of files, it just doesn’t return the right number.

I made a test script that will print the number of files in a specific “import” folder and as you can see in the attached screenshot, the script prints out the number 346 even though the folder actually contains 384 files.

If you wan to check it out for yourself, feel free to download my test script and place it in your ZBRUSH_ZStartup/ZPlugs64 folder.
Test.zip (1.2 MB)

I was wondering if someone has an idea on how to fix this or know of a workaround?

Thank you very much!
Gabriel

Hi Gabriel,

I’m sorry not to reply sooner.

I think this is a limitation of the ZFileUtils, caused by the memory buffer running out of space to store more file names. (If you had shorter file names you’d get a few more files!)

The ZFileUtils will need updating to be able to cope with more files. I will take a look just as soon as I can.

-Marcus

Hi,

Here’s a revised version of the ZFileUtils which should cope with a larger number of files:

ZFileUtils_2020_01B.zip (306.9 KB)

-Marcus

Hi @marcus_civis

I just tested your revised version of the ZFileUtils and it’s working perfectly now.
Thank you very much for your help! :smile:

Gabriel

Hi @marcus_civis

I have an issue with the command “LaunchAppWithFile” with your new ZFileUtils.
It used to work very well with the previous ZFileUtils but now, for some reason, it opens up a cmd.exe window when using this command and it’s freezing ZBrush until I close the window.

I use this command a lot in my scripts and I would really appreciate if you could troubleshoot this issue when you have some time.

Thank you!
Gabriel

I’m not getting that on my system. Which OS are you on and what zscript code are you using? Do you get the command window showing when running the ZFileUtils example code?

Thanks,
-Marcus

I’m using windows 10 version 2004.
I tested the script in the ZFileUtils example and it does work, but it’s not doing what I want.

What I’m trying to do is to open a file with the default application or opening the application directly, using the alternative “LaunchAppWithFile” call, but when doing that it opens up a cmd.exe window.

For example, trying to open the notepad application without a specific file:

[ISubPalette, "ZPlugin:ZFileUtilsTests"]
[ISubPalette, "ZPlugin:ZFileUtilsTests:Test"]

[VarSet, dllPath, "MyPluginData/ZFileUtils64.dll"]
[VarSet, appPath, "C:\Windows\System32\notepad.exe"]

[IButton,"ZPlugin:ZFileUtilsTests:Test:Test",,
	[VarSet, err, [FileExecute, [Var, dllPath], "LaunchAppWithFile", #appPath]]
	[If, err, [Note, "An error occurred.",, 2]]
, 0, 1]
1 Like

Ah, many thanks, that’s very useful. I found the problem. I changed the file above so try the new version - ZFileUtils_2020_01B (reload the page if it doesn’t show the ‘B’ at the end).

-Marcus

Thank you Marcus! :+1:
It’s working perfectly now with the latest version.

Cheers!
Gabriel

1 Like

That’s great, thanks for letting me know!
-Marcus