I’m scripting to creat a menu tearoff.
My files in “scene” folder is listed by menuitem.
But when open file by click my itemmenu, it is not open right file.
window -menuBar true -width 200; rowLayout;
string $path =workspace -q -rootDirectory+“scenes/Animation/”;
//global string $folderAni[];
string $folderopen[];
string $selectFile[];
menu -label “Animation” -tearOff true menuAniSelect;
string $subfolderlist[] =getFileList -folder $path;
int $i;
for ($i =0;$i<size($subfolderlist);$i++)
{
$folderopen[$i] = $path+$subfolderlist[$i];
menuItem -p menuAniSelect -label $subfolderlist[$i] -annotation $folderopen[$i] -subMenu true;
string $subfilelist[]=getFileList -folder $folderopen[$i] -filespec "*.*";
int $j;
for($j=0;$j<size($subfilelist);$j++)
{
$selectFile[$j] = $path+$subfolderlist[$i]+"/"+$subfilelist[$j];
string $command = “openSelec($selectFile[”+$j+"])";
menuItem -label $subfilelist[$j] -annotation $selectFile[$j] -command $command;
}
}
showWindow;proc string openSelec(string $pathSelect)
{
string $pathSelect;
print("file du?c ch?n là “+$pathSelect+”
");
file -open $pathSelect;
return $pathSelect;
}
i think my flow is wrong.
But i had not fixed it ! 