How to use DzProcess on a Mac?
I have created a small program that I am calling from Daz Script. The windows version works perfectly. I cannot get the Mac version to work.
First, where does Daz want these small programs to be located on a Mac (this is for a product to be sold)? On Windows, I can just put them in Data/RiverSoft Art/Common and it works fine as Windows isn't particular about where an exe runs from. On Mac, I have tried both just /Applications and /Applications/DAZ 3D/DAZStudio4 64-bit/bin. I can run my program directly from the shell in those two locations, e.g.,
$ /Applications/MyProgram.app/Contents/MacOS/MyProgram
This works. However, I cannot get the DzProcess code to work. The Process.start always returns false. Is it supposed to work on the Mac? Any help is appreciated. Here is my DzProcess code:
var sMacOSXTattooApp = '/Applications/MyProgram.app/Contents/MacOS/MyProgram';
[...]
if (App.platform() == App.Windows)
{
var file = helper.replaceAll(sWinTattooApp, '/', '\\');
var aProcessArgs = [
'"'+file+'"',
"getFont",
tempfile,
'DONOW'
// '"'+helper.replaceAll(tempfile, '/', '\\')+'"',
];
}
else if (App.platform() == App.MacOSX)
{
var file = sMacOSXTattooApp;
var aProcessArgs = [
'"'+file+'"',
"getFont",
tempfile,
'DONOW'
];
}
else
return [];
oProcess = new DzProcess();
// Assign the arguments
oProcess.arguments = aProcessArgs;
oProcess.communication = DzProcess.Stdin | DzProcess.Stdout;
// If starting the process fails
if( !oProcess.start() ){
// Inform the user
MessageBox.critical( qsTr("Could not start Word Tattoo. Please check your installation"), qsTr("Fatal Error"), qsTr("&OK") );
return [];
}
Comments
Did you succeed? Otherwise I can take a look as I might need to do something like this myself, call an app ;-)
One thing, the thing you call, is that an app bundle or the tool directly?
No, I didn't. From memory, I believe I call the tool directly at the command line which works. I tried both from DzProcess. If you can figure it out, that would be great. I would be happy to give you a copy of Word Tattoo for free
Try removing the double quotes for the MacOSX section.
Also, try specifying a working directory.
I will try both this weekend. Thanks.
Thank you very much! I finally got around to trying your suggestions... removing the double quotes worked! Yea!