-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.mel
38 lines (35 loc) · 1.35 KB
/
install.mel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
global string $gShelfTopLevel;
string $currentShelf = `tabLayout -query -selectTab $gShelfTopLevel`;
setParent $currentShelf;
string $asInstallScriptLocation=`asInstallScriptLocation`;
if (`gmatch $asInstallScriptLocation "*\*"`)
$asInstallScriptLocation=`substituteAllString $asInstallScriptLocation "\\" "/"`;
string $scriptName="batchExport";
string $sourceFile=$asInstallScriptLocation+$scriptName+".py";
string $command="import sys \n"+"sys.path.append(\""+$asInstallScriptLocation+"\")\n"+"import batchExport\n"+"batchExport = batchExport.batchExport()";
string $icon=$asInstallScriptLocation+$scriptName+".png";
if (!`file -q -ex $sourceFile`)
error ("Something went wrong, can not find: \""+$sourceFile+"\"");
shelfButton
-command $command
-annotation $scriptName
-label $scriptName
-image $icon
-image1 $icon
-sourceType "python"
;
global proc asInstallScriptLocator (){}
global proc string asInstallScriptLocation ()
{
string $whatIs=`whatIs asInstallScriptLocator`;
string $fullPath=`substring $whatIs 25 999`;
string $buffer[];
string $slash="/";
if (`gmatch $whatIs "*\\\\*"`)//sourced from ScriptEditor
$slash="\\";
int $numTok=`tokenize $fullPath $slash $buffer`;
int $numLetters=size($fullPath);
int $numLettersLastFolder=size($buffer[$numTok-1]);
string $scriptLocation=`substring $fullPath 1 ($numLetters-$numLettersLastFolder)`;
return $scriptLocation;
}