Needs the latest XYplorer BETA version (v9.30.0023, 29-jul-2010) or newer.
This script use one of the newest scripting enhancements:
//(inputselect() needs at least XY v9.30.0003)
//(enhanced report() needs at least v9.30.0022)
//(listfolder() needs at least v9.30.0023)
Thanks to Donald, great enhancements!
This script use listfolder() to get an list of all your scripts inside <xyscripts>
and the enhanced report() to get the wanted info {BaseName} and {Comment} from that list.
Than it use inputselect() to let you choose one or more scripts to run.
If you choose more then one script you are again prompted by inputselect() to select the first script to run.
THIS script waits till those "first" script is finished, then it ask you which next to run.
Note:
the script to run is only shown with his file name in an messagebox.
You have to remove the two "//" from //load $cript; to load $cript; to let it really works.
Test it first with care!
Show list of scripts.xys
Code: Select all
"Show list of scripts"
// Show an list of scripts out of "<xyscripts>" to select from. You may select several scripts at once.
// Needs the latest XYplorer BETA version (v9.30.0023, 29-jul-2010) or newer.
//generate list of scripts (without sub-folders):
//generate an filter to see only wanted scripts:
$preFilterScripts = input("Prefilter Script by part of
file name","Pattern, e.g. rename or B or *C", ,,"");
//get an list of wanted scripts:
//(listfolder() needs at least v9.30.0023)
$myScripts = listfolder("<xyscripts>", "$preFilterScripts*.xys");
//collect the base name without extension and the files comment into var $myScripts:
//(enhanced report() needs at least v9.30.0022)
$myScripts = report("{basename} - ({comment})|",$myScripts);
//show InputSelect-dialog to select one of those scripts:
//(inputselect() needs at least XY v9.30.0003)
$cripts = inputselect("Select one or more script to execute",$myScripts,,2);
//execute that choosen script(s):
//(if not inputselect() is cancelled)
If ($cripts>"")
{
//Count the choosen scripts:
$Loop=1;
$CountScriptsToExecute=0;
$array="";
while(true)
{
$cript = gettoken($cripts, $Loop, "|");
IF ($cript==""){break;}
$array = $array . $cript ."|";
incr $CountScriptsToExecute;
incr $Loop;
}
//Depending if one or more script is selected:
IF ($CountScriptsToExecute>1)
{
//execute several scripts:
while(true)
{
//ToDo: maybe "IF (strpos($array, "|") == -1) { execute last script without ask for}
$cript = inputselect("You choose several scripts<crlf>
select next script to execute",$array,,2);
//clean up the array:
$array = replace($array, $cript);
$array = regexreplace($array, "^\|(.+)", "$1");
$array = replace($array, "||");
$array = regexreplace($array, "^\|$");
IF ($array==""){break;}
//drop the comment part:
$cript = regexreplace($cript, "^(.+) - .+(\|)*$", "$1");
msg "Multi: " $cript,1;
//text readfile("<xyscripts>\" . $cript . ".xys");
//load $cript;
//this script waits till the called script is finished.
}
}else
{
//execute single script only:
$cript = gettoken($array, 1, "|");
//drop the comment part:
$cript = regexreplace($cript, "(.+) -.+", "$1");
msg "Single: " $cript,1;
//text readfile("<xyscripts>\" . $cript . ".xys");
//load $cript;
}
}
HTH?