Is it possible for the code to simply append numbering when collision occurs? My no-GUI version throws a Windows message on not being possible to create an existing item... (It seems dumb when doing run tests, but picture what happens when you have to deal with a huge list with dozens of folders/files, locked on a "date modified" sorting...)
Thanks!
Help ! Create new empty folders
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: Help ! Create new empty folders
Try this code.
I use just an HTML() Framework as standard GUI here:

CreateSeries.xys
EDIT: added $InitialPath
I use just an HTML() Framework as standard GUI here:
CreateSeries.xys
Code: Select all
//Example Framework for the XYplorer-script HTML() function
$InitialPath = "<curpath>";
$TextAreaDefault = "";
//$TextAreaDefault = "<clipboard>";
$GETResult = utf8decode(html('<HTML>
<BODY bgcolor="antiquewhite">
<FORM method="GET" action="xys:">
<TABLE width="99%" border="1" bgcolor="aquamarine">
<TR><TD width="15%"><B>Description</B></TD><TD> Create series of new items </TD></TR>
<TR><TD>TextArea:</TD> <TD> </TD></TR>
<TR><TD>option 1-4:</TD> <TD> 1: create folders 2: create files 3: 4: </TD></TR>
<TR><TD>Option5:</TD> <TD> Text before </TD></TR>
<TR><TD>Option6:</TD> <TD> start value </TD></TR>
<TR><TD>Option7:</TD> <TD> max value </TD></TR>
<TR><TD>Option8:</TD> <TD> Text after </TD></TR>
<TR><TD>Do it:</TD> <TD> Execute this script </TD></TR></TABLE>
<TEXTAREA name="FormResult" rows=6 cols=75>' . $TextAreaDefault . '</TEXTAREA><BR>
<INPUT type="radio" name="myOption" value="Option1" checked> Option 1
<INPUT type="radio" name="myOption" value="Option2" > Option 2
<INPUT type="radio" name="myOption" value="Option3" > Option 3
<INPUT type="radio" name="myOption" value="Option4" > Option 4 <BR>
Option5: <input type="text" name="Option5" size="80" Value=""> <BR>
Option6: <input type="text" name="Option6" size="80" Value=""> <BR>
Option7: <input type="text" name="Option7" size="80" Value=""> <BR>
Option8: <input type="text" name="Option8" size="80" Value=""> <BR>
<P align="right"><INPUT type="submit" name="Submit" value="Do it"> </P>
</FORM>
</BODY>
</HTML>',"700", "630", "myWindowsTitle"));
//get the results:
// IF you press the [Close]-button of the dialog
// instead of the [Submit]-button of the form or on an link,
// then the result of HTML() is empty/nothing:
IF ("$GETResult"=="") {sub "_Cancel";}
// remove leading '?' from $GETResult content
substr $GETResult, $GETResult, 1;
//split the result into parts:
// split $GETResult into parts at the '&' sign and give me part N0. 1
// for example 'FormResult=textareacontent&myOption=Opt2&fname=J'...etc.
// becomes 'FormResult=textareacontent'
$FormResult = gettoken($GETResult, "1", "&");
// Then:
// split $FormResult into parts at the '=' sign and give me part N0. 2
// for example 'FormResult=textareacontent'
// becomes 'textareacontent'
$TextArea = urldecode(gettoken($FormResult, 2, "="));
//now do the same for all other parts:
$myOption = gettoken($GETResult, "2", "&");
$myOption = urldecode(gettoken($myOption, 2, "="));
//----
$Option5 = gettoken($GETResult, "3", "&");
$Option5 = urldecode(gettoken($Option5, 2, "="));
//----
$Option6 = gettoken($GETResult, "4", "&");
$Option6 = urldecode(gettoken($Option6, 2, "="));
//----
$Option7 = gettoken($GETResult, "5", "&");
$Option7 = urldecode(gettoken($Option7, 2, "="));
//----
$Option8 = gettoken($GETResult, "6", "&");
$Option8 = urldecode(gettoken($Option8, 2, "="));
//
//now do what you want with this results:
msg "Content of the textarea is: $TextArea <crlf>
Option 1-4 is: $myOption <crlf>
Option5: $Option5 <crlf>
Option6: $Option6 <crlf>
Option7: $Option7 <crlf>
Option8: $Option8 <crlf>",1;
// YOUR script goes here:
IF ($myOption == "Option1") {$ItemType = "dir";}
IF ($myOption == "Option2") {$ItemType = "file";}
$TextBefore = $Option5;
$StartValue = $Option6;
$MaxAmount = $Option7;
$TextAfter = $Option8;
$Count=1;
while($Count<=$MaxAmount)
{
$Value = $StartValue -1 + $Count;
while (strlen($Value)<strlen($StartValue)){$Value = 0$Value;}
new $InitialPath\$TextBefore$Value$TextAfter , $ItemType;
incr $Count;
}
////////////////////////////////////////////////////////////////
"_Cancel"
msg "Cancled by user";
sub "_EOF";
"_EOF"
END 1==1;
//EOF
Last edited by Stefan on 05 Aug 2010 19:45, edited 1 time in total.
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
Astonishing.
Worked great for both files and folders.
-files: IF told by user to do so (checkbox?), can they have an option to create out of any "base new item.ext", selected by user anywhere in the computer starting (default) from XY "NewItems" folder? Just an idea...
Item creation most of the times is not a mere question of what extension it has...
For me, it's better than I ever thought as it is!
Worked great for both files and folders.
-files: IF told by user to do so (checkbox?), can they have an option to create out of any "base new item.ext", selected by user anywhere in the computer starting (default) from XY "NewItems" folder? Just an idea...
Item creation most of the times is not a mere question of what extension it has...
For me, it's better than I ever thought as it is!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
Is it possible to make the script read original base files and reproduce their date/file attributes so I can artificially duplicate them at their empty folders counterparts? So I can easily browse them on huge lists, having at first sight their original timelines without having to look after the catalog from where they derive. Just a little idea (easy to implement, I believe) that will bring me a huge benefit I can't even think of until I saw the wonder at work. Anyway, THANKS!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: Help ! Create new empty folders
Added $InitialPath:SkyFrontier wrote: side notice: if you click on the opposite panel, the script will continue to create folders in it,
so you must set the original pane as active again
$InitialPath = "<curpath>";
...
new $InitialPath\$TextBefore$Value$TextAfter , $ItemType;
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Help ! Create new empty folders
Thanks, Stefan.
Will check that later - on a real scenario (script running with at least 500 folders to create). Currently can't do that - heavy load on CPU. Also, will test the "create files" instead of folders to see if this improves speed in a task as described in the original thread.
Will report a.s.a.p.
Thank you.
Will check that later - on a real scenario (script running with at least 500 folders to create). Currently can't do that - heavy load on CPU. Also, will test the "create files" instead of folders to see if this improves speed in a task as described in the original thread.
Will report a.s.a.p.
Thank you.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
XYplorer Beta Club