Thought I’d start a thread of for small but useful little scripts where the emphasis is on the idea rather than the implementation. Kind of sparked from a small code block I did last week which is proving really useful. I was doing some debugging and getting fed up with going…
whatIs
then scanning for the path. So this little proc does the whatIs then wraps it in a system open for either the script itself, or it’s directory:
global proc whatIsOpen(string $MelProc , int $fileOrDir)
{
$Proc= ("whatIs " + "\"" + $MelProc + "\"");
$TestPath = `eval $Proc`;
string $script= substitute( "Mel procedure found in: ", (string)$TestPath, "");
string $filepart = (string)`match "[^/\\]*$" $script`;
string $mainDir = `substitute $filepart $script""`;
if($fileOrDir == 0)
{
//system("load " + $mainDir );
system ("explorer /select, \"" + `toNativePath($script)` +"\"");
}
else
system("load " + $script);
}
It’s often these little gems that save more time than anything else
Mark