PDA

View Full Version : if about weirdness


cgbeige
02-04-2011, 09:59 PM
Why would this script try to source the missing Windows path if it correctly returned "1" for the Mac part? The script fails because it says it can't find the path in C: which I obviously don't want to check for.

global proc GoZbuddyPreScript()
{
string $mySelection[] = `ls -sl`;
duplicate -rr -name ($mySelection[0] + "_GoZmesh") $mySelection[0];

if ( `about -mac` )
{
source "/Users/Shared/Pixologic/GoZApps/Maya/GoZBrushFromMaya.mel";
}
else
{
source "C:/Users/Public/Pixologic/GoZApps/Maya/GoZBrushFromMaya.mel";
}
}

gmask
02-04-2011, 10:06 PM
I dunno but maybe you should put a print statement in both to confirm which it is going to to make sure.. or change it to `about -mac` == 1

cgbeige
02-04-2011, 10:24 PM
doesn't make a difference (tried it and it fails). I have other scripts that work fine without it:

$timestamper = `date -format YYYYYYMMDDhhmmss`;
string $mySelection[] = `ls -sl`;

if( `about -win`)
{
system ((("md %TEMP%") + "\\") + $timestamper);
file -force -options "(groups=1;ptgroups=1;materials=1;smoothing=1;normals=1"
-typ "OBJexport" -pr
-es ((("%TEMP%/" + $timestamper + "/") + $mySelection[0]) + ".obj");
system ((("%TEMP%" + "\\") + $timestamper + "\\") + $mySelection[0] + ".obj");
}
else
{
system (("mkdir /tmp/") + $timestamper);
file -force -options "(groups=1;ptgroups=1;materials=1;smoothing=1;normals=1"
-typ "OBJexport" -pr
-es ((("/tmp/" + $timestamper + "/") + $mySelection[0]) + ".obj");
system ((("open /tmp/") + $timestamper + "/") + $mySelection[0] + ".obj");
}

gmask
02-04-2011, 10:43 PM
okay .. sorry to be so pedantic but you are telling me that if you run `about -mac` on it's own in the script editor it returns 1 but when you put it in the `if` statement it does the opposite?

What happens if you just source the script directly.. does it load without error?
source "/Users/Shared/Pixologic/GoZApps/Maya/GoZBrushFromMaya.mel";

NaughtyNathan
02-04-2011, 11:31 PM
I think it may be something to do specifically with the source command. Technically source is not a MEL command, it's a directive(?) (like for/if/else/etc..), so you can't use it in this manner. Try wrapping both source lines (individually) inside an eval("") and that might fix it.

eval("source \"file.mel\" ");:nathaN

gmask
02-04-2011, 11:33 PM
I think it may be something to do specifically with the source command. Technically source is not a MEL command, it's a directive(?) (like for/if/else/etc..), so you can't use it in this manner. Try wrapping both source lines inside an eval("") and that might fix it.

:nathaN

Ah.. you're totally right about that..

cgbeige
02-05-2011, 01:07 AM
Ah thx. I'll try that later

cgbeige
02-05-2011, 05:16 PM
works great - Thanks again, Nathan

CGTalk Moderation
02-05-2011, 05:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.