ZBrushCentral

ZFileUtils not working in Z4??

Hi there

I am trying to use ZFileUtils.dll for ZScript utilities , it used to work in Z3 and even Z3.5 but now suddenly it refuses to work!!!

This is the issue:

I applied [RoutineCall, CheckSystem] exactly in the same way as was described on the Wiki, I copied and pasted it literally. The ZFileUtils.dll file is in same directory as my ZScript.

However here’s the thing, even though [FileExists, [Var,utilDLLPath]] returns 1, i.e. it notices that the file exists, whenever I run something involving FileExecute, i.e. [FileExecute, [Var,utilDLLPath], Version] I always get this error:
“Specified execute-file could not be found”

Even when fileExists returns true, and I’ve tried relative path, absolute path to access it etc everything, it’s not a question of reading wrong directory I don’t think.

Is the dll broken or something, it doesn’t work in Z4, what exactly, as the error makes no sense to me. Is FileExecute command broken?

Would appreciate help here.
Cheers!

It is working fine here. Maybe a problem with the path slashes?

[VarDef, utilDLLPath,“ZFileUtils.dll”] works fine with the script in the same directory.

[VarDef, utilDLLPath,"/ZFileUtils.dll"] does not work. Cannot remember how it was in earlier versions of ZBrush. But I do not think anything has changed.

I have only been testing on PC, are you on a Mac?

Usually when that happens to me I have forgotten to call the CheckSystem routine from the button. The only other possibility is, as Mark says, an error in the path you are setting for the dll. It works fine for me, so if you can’t find the problem post a sample script so we can track down what’s wrong.

Hey thanks guys
Probably the problem is something beyond ZScript

Because look at this scenario.
The utils file is in exactly the same directory as my ZScript that I’m running

and yet even this script which has nothing wrong gives same error


 
  [VarDef, isMac, 0]		  // Mac or Win?
  [VarDef, utilDLLPath,""]   // Where is the ZFileUtil dll?
  [VarDef, utilDLLVersion, 0] // What is the version of ZFileUtil?
  
  [RoutineDef, CheckSystem,	
    [VarSet,isMac, [ZBrushInfo,6]]	
    // Make sure we have the dll.
   [If,isMac,
 	 [VarSet,utilDLLPath,"ZFileUtils.lib"],
 	 [VarSet,utilDLLPath,"ZFileUtils.dll"]
    ]
    [If, [FileExists, [Var,utilDLLPath]], //check that correct version
 	 [VarSet, utilDLLVersion, [FileExecute, [Var,utilDLLPath], Version]]
 	 [If, [Val,utilDLLVersion*10] >= 18, // Multiply version by 10 for test
 	   //OK
 	 , //else earlier version			
 	   [Note,"\Cff9923ZScript Note:\Cc0c0c0 The \Cff9923Z\CffffffFileUtils\Cc0c0c0 DLL is an earlier version. Please install correct version."]
 	   [Exit]
 	 ]			
    , // else no DLL.
 	 [Note,"\Cff9923ZScript Note:\Cc0c0c0 The \Cff9923Z\CffffffFileUtils\Cc0c0c0 plugin could not be found."]
 	 [Exit]
    ]
  ]
  
  [ISwitch,"test,0,"", [RoutineCall, CheckSystem],,0]

 

(error is invoked when I run fileExecute within CheckSystem routine)

I’ll have to investigate this lol
Thanks guys anyhow

I got no error when running your script (apart from having to close the string for the name of the switch).

The only other thing I can think of is that this is a permissions issue with the location of your script.

Hm, played around with permission settings but that doesn’t seem to be the issue.

Somehow i think it can actually find the dll but can’t run it.

Could it be a 32-bit dll on 64-bit machine issue? I tried a test, so that basically I duplicated ZFileUtils.dll and made it an empty dll (deleted everything in its body, i know a very silly test lol) and then ran the script. This time I got a very different error message, a ‘bad image’ error message with a description, which means that FileExecute is actually executing the file i.e. it CAN actually find it (that particular error message proves it), then this error message is followed by the original error msg i mentioned, otherwise i would have only got the error message I got previously.

So strange… Not sure exactly what it is, but is there a 64-bit of this dll? Maybe that could help ^^ I have no clue at this point

It’s not a 64 bit issue. I have a 64 bit machine. Also, if you can run ZBrush 4 plugins without problems then it is not a zscript-to-dll issue. Are you sure that your ZFileUtils.dll is not corrupted?

hm, can u giv me an example of a plugin that uses the Utils file so i can test it?
Thx!

My point was that most of the plugins use a dll which is no different from the ZFileUtils other than in their functions - the exact same set of arguments and called from ZBrush in the same way. They all have a ‘Version’ function which is called just like in ZFileUtils. Therefore, if you can use (for example) Transpose Master with ZB4 without it throwing a DLL error message then it seems likely that your ZFileUtils file is corrupted.

Copy the Transpose Master DLL from the TM Data folder and use that to test your script (just call the ‘Version’ function).

Hey guys thanks!

It turns out there wasnt really a problem with the code or dll, only a prob with my Zbrush installation i think

I reinstalled Zbrush and it works now, dunno why, strange
Anyhow, Solved

Cheers