Hello, i have been mushing around with MEL syntax problem that i just cant fix, so i will put it here on the internet and beg that a wild coder appears.
The problem lies in this code:
proc ExportSelectedObject(){
$path = `file -q -sn`;
$h = `file -q -sn -shn`;
print $path;
$nameLength = size($h);
$fullPathLength = size($path);
$SubstringValue = $fullPathLength - $nameLength;
$RealPath = `substring $path 1 $SubstringValue`;
$ExportPath = $RealPath + "Export/";
$q = `ls -sl -o`;
sysFile -makeDir $ExportPath;
$FullExportPath = $ExportPath + $q[0] + ".fbx";
file -force -options "v=0;" -typ "FBX export" -pr -es $FullExportPath;
}
ExportSelectedObject();
when i run it, it return the error: // Error: line 11: Invalid call to “substring”. Check number and types of arguments expected by the procedure. //
but if i don’t wrap the code in a function like this:
$path = `file -q -sn`;
$h = `file -q -sn -shn`;
print $path;
$nameLength = size($h);
$fullPathLength = size($path);
$SubstringValue = $fullPathLength - $nameLength;
$RealPath = `substring $path 1 $SubstringValue`;
$ExportPath = $RealPath + "Export/";
$q = `ls -sl -o`;
sysFile -makeDir $ExportPath;
$FullExportPath = $ExportPath + $q[0] + ".fbx";
file -force -options "v=0;" -typ "FBX export" -pr -es $FullExportPath;
Everything runs and no error is given.
Problem is i need to wrap it in a function as this have to be connected to a interface.
I hope someone can help with this.