SyntaxHighlighter

2015年7月2日木曜日

カレントディレクトリ等をExplorerで開くmel

カレントディレクトリ等を開くmel
数字でオープン先を選ぶ

global proc sDirOpen()
{  
    //-----------------------------------------------------------------------------------------------------
    string $fPath = `file -q -sceneName`;
    string $fName = `file -q -shortName -sceneName`;
    string $sPath = substituteAllString($fPath, $fName , "");
    string $iPath = substituteAllString($sPath, "scenes/"  , "images/");
    string $itPath = substituteAllString($sPath, "scenes/"  , "images/tmp/");
    //-----------------------------------------------------------------------------------------------------
    string $text;
    string $result = `promptDialog
        -title "sDirOpen"
        -message "input Number:"
        -text "0"
        -button "OK" -button "Cancel"
        -defaultButton "OK" -cancelButton "Cancel"
        -dismissString "Cancel"`;

    if ($result == "OK")
    {
        $text = `promptDialog -query -text`;
        if($text == 0)
        {
        print ($sPath + "\n");
        string $sOsPath = substituteAllString($sPath, "/", "\\");
        print ($sOsPath+ "\n");
        system ("explorer.exe "+ $sOsPath);
        }
        else if($text == 1)
        {
        print ($iPath + "\n");
        string $iOsPath = substituteAllString($iPath, "/", "\\");
        system ("explorer.exe "+ $iOsPath);
        }
        else if($text == 2)
        {
        string $itOsPath = substituteAllString($itPath, "/", "\\");
        system ("explorer.exe "+$itOsPath);  
        }
        else
        {
        string $window = `window -title "alart"
        -iconName "Short Name"
        -widthHeight 64 24`;
        columnLayout -adjustableColumn true;
            button -label "ねーっす :-P" -command ("deleteUI -window " + $window);
            setParent ..;
            showWindow $window;
        //print "ねーっす";
        }
    }
}
sDirOpen()

0 件のコメント:

コメントを投稿