Code: Select all
v9.30.0003 - 2010-07-20 11:05
+ Scripting got a new function.
Name: inputselect
Action: Pops a list of strings from which the selected one is
returned.
Syntax: inputselect(header, listdata, [delimiter=|], [style=1], _
[cancel], [width=600], [height=400], [windowcaption])
header: First line is printed in bold; any other lines are
printed non-bold; leave empty to show no header.
listdata: String of list items, delimited by delimiter.
delimiter: Delimiter; defaults to |.
style: 1 = show file system icons for the items (= default)
2 = show checkboxes
prefix items with "+" to pre-check them
cancel: value to be returned when user cancels
if not set then cancel will terminate the script
width: Width of window in pixels (minimum: 250; maximum:
screen width; default: 600).
Percentages of screen width are supported, e.g. 75%.
height: Height of window in pixels (minimum: 150; maximum:
screen height; default: 400).
Percentages of screen height are supported, e.g. 75%.
windowcaption: Window caption.
return: The selected list item. If checkbox style then the
checked items are returned, separated by delimiter.
Examples:
// header and a list of drives; then go to the selected drive
goto inputselect("Select Destination", "C:|D:|E:");
// same with two-line header
goto inputselect("Select Destination".<crlf>."Choose drive:", "C:|D:|E:");
// no header
goto inputselect(, "C:|D:|E:");
// use checkboxes and icons (1 OR 2 = 3)
text inputselect("Select Drives", "C:|D:|E:", , 3);
// use checkboxes, pre-check "D:"); return "-" on cancel
text inputselect("Select Drives", "C:|+D:|E:", , 3, "-");First test
Show an dialog to select an script:
Code: Select all
//store current environment:
//the current folder:
$curFolder = "<curpath>";
//the current selected files:
$curSelFiles = report("{name}|",1);
//are there any file selected?:
$CountSelected = getinfo("CountSelected");
//generate list of scripts (without sub-folders):
goto "<xyscripts>";
$preFilterScripts = input("Pre filter scripts by part of file name","Pattern, e.g. rename or B or *C", ,,"");
//select only scripts *.xys
selfilter "$preFilterScripts*.xys",f;
//collect all selected files
//without extension into var $myScripts
$myScripts = report("{basename}|",1);
//cosmetic: de-select all
sel;
//go back to work folder:
goto $curFolder;
//select the wanted file again (if any):
If ($CountSelected > 0){ selfilter $curSelFiles; }
//show InputSelect-dialog to select an script: (needs at least XY v9.30.0003)
$cript = inputselect(Select an script to execute:,$myScripts);
//and execute that script (if not cancelled):
If ($cript>""){ load $cript; }
--------------
EDIT:
changed
goto "<xypath>\scripts";
to
goto "<xyscripts>";
EDIT:
added $preFilterScripts
Update changelog
----------------
EDIT:
added BatchNewItemSerie_v5.xys
Code: Select all
"NewItems"
$listdata = "+A-Z series (Items from A to Z)|0-9 series (Items from 0 to 9)|1-100|Create DIRs|+Create Files";
//inputselect(header, listdata, [delimiter=|], [style=1], _
// [cancel], [width=600], [height=400], [windowcaption])
$inputselect = inputselect("Create files or dirs", $listdata,,2);
//msg $inputselect,1;
IF (strpos($inputselect, "Create DIRs")>0) {$Type = "dir";}
IF (strpos($inputselect, "Create Files")>0){$Type = "file";}
IF (strpos($inputselect, "Pad Zeros")>0) {$SerieAmountPad = "yes";}
IF (strpos($inputselect, "A-Z")>-1)
{
//create items A-Z
$AZExt = ""; IF ($Type=='file'){$AZExt = ".TXT";}
$count = 1;
while($count<27)
{
new "<curpath>\" .chr($count + 64) . $AZExt, $Type;
wait 50;
$count++;
}
}
IF (strpos($inputselect, "0-9")>-1)
{
//create items 0-9
$digitExt = ""; IF ($Type=='file'){$digitExt = ".TXT";}
$count = 0;
while($count<10)
{
new "<curpath>\" . $count . $digitExt, $Type;
wait 50;
$count++;
}
}
IF (strpos($inputselect, "1-100")>-1){msg "1-100 is not implemented yet ;-)";}
XYplorer Beta Club