Piosio

AutoItX3.dll and Zbrush

1 post in this topic

#1 ·  Posted (edited)

Hi!

Hope there is someone who can help.

ZBrush - 3D Sculpting program have it's own script language(ZScript) that is quite limited. But it have ability to extend his language by executing routines from external .DLL 

Here is how you call routine from external dll from Zbrush:

[FileExecute, File name including the extension (such as plugin.dll ),Routine to call, Optional text input, Optional number input, Optional memory block input, Optional memory block output]
xecutes the specified plugin file (DLL). Output: Returns the result value which was returned by the executed routine. Returns zero if error
Example: [FileExecute, PluginTest.dll, ShowMsg, "Hi There"]
Executed the “ShowMsg” routine of the “PluginTest.dll” plugin

I have wrote DLL in c++ which I use to start windows applications from Zbrush via his own script language.

//PiosioUtils.dll
#include <Windows.h>
#include "shellapi.h"
#define DLLEXPORT __declspec(dllexport)

extern "C" long double DLLEXPORT LaunchAppWithFile(LPCSTR lpFile, int a2, int a3, int a4)
{
  const CHAR *v5; // application path
  const CHAR *v6; // file to open by application path

   if (a4 != 0 && lpFile != 0)
 {
   v6 = lpFile;
   v5 = (const CHAR *)a4;
 }
  else
 {
  if (a4 != 0 || lpFile == 0)
    return -1.0;
  v5 = lpFile;
  v6 = 0;
 }
ShellExecuteA(0, "open", v5, v6, 0, 1);

return 0.0;
}
Now to launch Notepad from Zbrush using my own dll You call routine like that:
[FileExecute,"c:\VS2013\Projects\PiosioUtils\x64\Debug\PiosioUtils.dll",LaunchAppWithFile,"notepad.exe"]

Was trying to use AutoItX3_x64.dll to run notepad.exe but without results. Zbrush have found AU3_Run routine in dll but notepad didnt started.

[FileExecute,"C:\Program Files (x86)\AutoIt3\AutoItXAutoItX3_x64.dll",AU3_Run,"notepad.exe"]

I'm rly bad at coding but i belive notepad didnt started because zbrush gave to AutoItX3_x64.dll path to Notepad.exe in the way Autoit don't understand.

I think here is the main difference: to call routine from  AutoItX3_x64.dll  you have to give call it like that:

AU3_Run(L"notepad.exe", L"", 1);

and when i call it from my own dll:

ShellExecuteA(0, "open", notepad.exe, 0, 0, 1);

I Believe someone who have good knowledge of c++ can write dlll that would receive calls from Zbrush translate it and send it do autoit.dll in the way autoit will understand

Edited by Piosio

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now