Sweet, I added an improved version of this idea.TheQwerty wrote:In the same vein I'd like to see a function that sorts data.SkyFrontier wrote:Can inputselect have sorting options?
At least "sort by name" and "sort by modification date" with respective ascending/descending options would be great. The more sorting modes can be implemented, the better.
Thanks!
(I'm yet to figure out which order it uses to display my files...)
Sort( List, [Mode], [Dir], [Delimiter] );
Mode: S = Case Sensitive; I = Case Insensitive; N = Numeric (1,2,10 instead of 1, 10, 2)
Dir: 1 = Ascending, 0 = Descending
Delimiter: How List should be split, default '|'.
Might even be nice to include an option to delete duplicate items but that's less important.
Then you could combine this with a Report to sort the data with whatever field you like before giving it to InputSelect.
Minor scripting related wishes (a generic thread)
-
- Site Admin
- Posts: 60595
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Minor scripting related wishes (a generic thread)
FAQ | XY News RSS | XY Twitter
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
...so now you may have a better picture of how valuable your software really is, I presume...?admin wrote: Didn't they have good enough file managers on the planet you are coming from?
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: Minor scripting related wishes (a generic thread)
A bit more complicated than what I was aiming for since the quoting & trimming could already be accomplished with (Regex)Repalce, but that should make it easier for some of the non-scripters. Looks good!admin wrote:Sweet, I added an improved version of this idea.
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
Code: Select all
v9.70.0001 - 2010-11-06 16:12
+ Scripting got a new function.
Name: formatlist
Action: Formats a list of items.
...
But it would be really useful if another parameter could be added: something to display duplicates only (of course I'm talking on displaying/counting perhaps items out of a TEXT list which supports duplicated entries). Perhaps this can provide a way to report separately such duplicated items, then removing them via the surprising d = remove duplicate items parameter. I think it makes sense...
(not to mention that I'd really like to be able to sort stuff by dates, modified at least, but - s = sort ascending [by default case-insensitive: A==a] brings some order to chaos, no doubt on that!)
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...
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
...is it just an impression or I really can't have a total count for selected items' size via script?
If this is possible, can someone please enlighten me on how? My goal is to have a simple way to compare (display simultaneously via "msg", "echo" or "text") selected items' sizes on both panes at any time.
Thanks!
If this is possible, can someone please enlighten me on how? My goal is to have a simple way to compare (display simultaneously via "msg", "echo" or "text") selected items' sizes on both panes at any time.
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...
-
- Site Admin
- Posts: 60595
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Minor scripting related wishes (a generic thread)
I'll add it.SkyFrontier wrote:...is it just an impression or I really can't have a total count for selected items' size via script?
If this is possible, can someone please enlighten me on how? My goal is to have a simple way to compare (display simultaneously via "msg", "echo" or "text") selected items' sizes on both panes at any time.
Thanks!
FAQ | XY News RSS | XY Twitter
Re: Minor scripting related wishes (a generic thread)
Is this script not part of your library? http://www.xyplorer.com/xyfc/viewtopic. ... 869#p35869SkyFrontier wrote:...is it just an impression or I really can't have a total count for selected items' size via script?
If this is possible, can someone please enlighten me on how? My goal is to have a simple way to compare (display simultaneously via "msg", "echo" or "text") selected items' sizes on both panes at any time.
Thanks!
Would be easy to convert it to work on just the selection instead of full branch...
EDIT: Ugh.. it's too early... I suppose you probably want it to work on folders as well so it's not as nicely done.
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
Yep, you' right!TheQwerty wrote: EDIT: Ugh.. it's too early... I suppose you probably want it to work on folders as well so it's not as nicely done.
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...
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
Playing a bit while we don't have the official way - can someone tell me how to get the conditional commands working at the section $f;?admin wrote:I'll add it.SkyFrontier wrote:...is it just an impression or I really can't have a total count for selected items' size via script?
If this is possible, can someone please enlighten me on how? My goal is to have a simple way to compare (display simultaneously via "msg", "echo" or "text") selected items' sizes on both panes at any time.
Thanks!
Code: Select all
$type = confirm("Only files or folders too?<br><br>OK for Files only,<br>Cancel for Folders too.");
$f = ($type) ? 'focus' : '#487';
"$f"; //display folder sizes, if it's the case
//NOT works! setting "ShowFolderSizeInList", 1;
// #487;
$c= report ("{Size B}+", 1); $t= substr ($c, 0,-1); replace $t, $t, "-","0"; $t= eval ($t);
focus pi;
$c2= report ("{Size B}+", 1); $t2= substr ($c2, 0,-1); replace $t2, $t2, "-","0"; $t2= eval ($t2);
setting "ShowFolderSizeInList", r; //does NOT unset option set by #487! :?
Echo("File sizes on original pane are: $t bytes, <crlf>while in the opposite pane are $t2 bytes.<crlf>-Have a nice day!");
...wondering: will report/eval really sum up all values for both files+folders? Stay tuned for the next chapter, boys and girls!
---
Here's a simple script that works for files only on both panes, in case of anyone gets interested:
Code: Select all
$a = Eval(Report("+{Dir 0|{Size B}|0}", 0, "0"));
focus pi;
$b = Eval(Report("+{Dir 0|{Size B}|0}", 0, "0"));
Echo("File sizes on original pane are: $a bytes, <crlf>while in the opposite pane are $b bytes.<crlf>-Have a nice day!");
Hint: 1st script work for selected items, 2nd for all items displayed on list.
Thank you!
EDIT: Improved the test code a bit. Now it calculates selections containing folders, too - but still doesn't work as a "confirm" result...
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...
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
This is an attempt to circumvent the problem described on my previous post (trying to run two different scripts out of a "confirm: ok/cancel" dialog).
It makes sense to my newbie-scripter mind.
-why it doesn't work?!
-why setting "ShowFolderSizeInList", 0; is not refreshing folder to NOT display folder size in list at the end of the operation in "_ONE"?
Thank you!
It makes sense to my newbie-scripter mind.
-why it doesn't work?!
-why setting "ShowFolderSizeInList", 0; is not refreshing folder to NOT display folder size in list at the end of the operation in "_ONE"?
Code: Select all
$x = Sub "_ZERO";
$y = Sub "_ONE";
$type = confirm("Only files or folders too?<br><br>OK for Files only,<br>Cancel for Folders too.");
$f = ($type) ? '$x' : '$y';
"$f";
"_ZERO"
$a = Eval(Report("+{Dir 0|{Size B}|0}", 0, "0"));
focus pi;
$b = Eval(Report("+{Dir 0|{Size B}|0}", 0, "0"));
Echo("File sizes on original pane are: $a bytes, <crlf>while in the opposite pane are $b bytes.<crlf>-Have a nice day!");
"_ONE"
#487;
focus pi;
#487;
$c= report ("{Size B}+", 1); $t= substr ($c, 0,-1); replace $t, $t, "-","0"; $t= eval ($t);
focus pi;
$c2= report ("{Size B}+", 1); $t2= substr ($c2, 0,-1); replace $t2, $t2, "-","0"; $t2= eval ($t2);
setting "ShowFolderSizeInList", 0;
Echo("File sizes on original pane are: $t bytes, <crlf>while in the opposite pane are $t2 bytes.<crlf>-Have a nice day!");
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: Minor scripting related wishes (a generic thread)
I don't checked your whole script,
but the last command in the first section should be >sub "$f";<
but the last command in the first section should be >sub "$f";<
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
Hi, Stefan.
No go.
The scripts work as expected individually, but I'm yet to find a way to launch them as intended - ok for the first, cancel for the second - or anything else on the same approach (a little description with 2 buttons to launch one or another script).
Thanks.
No go.
The scripts work as expected individually, but I'm yet to find a way to launch them as intended - ok for the first, cancel for the second - or anything else on the same approach (a little description with 2 buttons to launch one or another script).
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: Minor scripting related wishes (a generic thread)
Oh, there is the "sub" now i see it.
You mean something like
And more generally example for reference:
But, BTW, we are in the wrong thread (" Minor scripting related wishes (a generic thread)") i think.
You mean something like
Code: Select all
$answer = confirm("Only files or folders too?<br><br>OK for Files only,<br>Cancel for Folders too.")?"_ZERO":"_ONE";
sub $answer;
"_ZERO"
msg "zero Files";
"_ONE"
msg "one Folder";
Code: Select all
$answer = confirm("Make your choice...")?"OK":"Cancel";
sub "_$answer";
"_OK"
msg "You pressed OK, how nice of you ;-)";
"_Cancel"
msg "He! why did you pressed Cancel?";
But, BTW, we are in the wrong thread (" Minor scripting related wishes (a generic thread)") i think.
Re: Minor scripting related wishes (a generic thread)
And to get it back to the topic... is there anyway Format() could be expanded to convert sizes (bytes) to the various units?Stefan wrote:But, BTW, we are in the wrong thread (" Minor scripting related wishes (a generic thread)") i think.
Would be nice to eliminate having to do the math & juggling:
Code: Select all
if ($exp >= 1099511627776) { $suffix = "TB"; $exp = $exp / 1099511627776; }
elseif ($exp >= 1073741824) { $suffix = "GB"; $exp = $exp / 1073741824; }
elseif ($exp >= 1048576) { $suffix = "MB"; $exp = $exp / 1048576; }
elseif ($exp >= 1024) { $suffix = "KB"; $exp = $exp / 1024; }
else { $suffix = "B"; }
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Minor scripting related wishes (a generic thread)
Oh, yes, I noticed - the thing was the script was in the context of the wish (which was of relevance) and I decided to keep it rolling instead of just opening another thread just for the sake of it. Made sense to me like that.Stefan wrote: But, BTW, we are in the wrong thread (" Minor scripting related wishes (a generic thread)") i think.
Now that we have a final script out of the wish, here's the proper thread for any further discussion: Display Sum of Files and Folders' Sizes on both Panes
Thank you also for the generic/didactic version of your answer, Stefan! I always try to keep in mind that such stuff will remain for future usage of anyone stumbling upon the forums (just wish I had the time to make more comments on my own scripts on that very fashion... ).
Again, 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...