DiskManager

Discuss and share scripts and script files...
PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: DiskManager

Post by PeterH »

I think I've got it :?:
(Just learning a bit of scripting again :roll: )

There's a piece of code in your script:

Code: Select all

  IF ($newsize == "- " || $newsize == "0") {
   $evalpercent="0.0";
   }
   ELSEIF ($evalpercent == "0.00") {
   $evalpercent="< 0.01";
  }
  ELSE{
  $newpercent= gettoken ($percent,$token,"<crlf>");
  $evalpercent= eval ($newpercent);

  $dotpos= strpos($evalpercent,".",0);
  $integer= substr ($evalpercent,0,$dotpos);
  $decimal=substr ($evalpercent,$dotpos,3);
  $evalpercent="$integer$decimal";
  }
...in the first mentioned ELSEIF the var $evalpercent isn't yet calculated, and so shows the value from the previous line. That is: if the previous line showed 0.00 the current will show <0.01 :)
Should be about:

Code: Select all

  IF ($newsize == "- " || $newsize == "0") {
    $evalpercent="0.0";
  }
  ELSE{
    $newpercent= gettoken ($percent,$token,"<crlf>");
    $evalpercent= eval ($newpercent);
  
    $evalpercent = substr($evalpercent, 0, strpos($evalpercent, ".")+3); // trunc to 2 decimals
/* *** next 4 lines commented: replaced by previous line
    $dotpos= strpos($evalpercent,".",0);
    $integer= substr ($evalpercent,0,$dotpos);
    $decimal=substr ($evalpercent,$dotpos,3);
    $evalpercent="$integer$decimal";      *** */
    IF ($evalpercent == "0.00") {
      $evalpercent="< 0.01";    }
  }
------

By trying to understand the code I noticed a part that could be much shorter - with the same function. Here a piece of code with your old part commented by /* */, and a replacement in front of it. You could use the replacement, if you like:

Code: Select all

  $totalKB = substr($totalKB, 0, strpos($totalKB, ".")+3); // trunc to 2 decimals
  $totalMB = substr($totalMB, 0, strpos($totalMB, ".")+3);
  $totalGB = substr($totalGB, 0, strpos($totalGB, ".")+3);

/* ****                                   //123.4567
  $getKB= gettoken ("$totalKB",1,".");    //123
  $dotpos= strpos($totalKB,".",0);        //3
  $integer= substr ($totalKB,0,$dotpos);  //123
  $decimal=substr ($totalKB,$dotpos,3);   //.45
  $totalKB="$integer$decimal";            //123.45
  
  $getMB= gettoken ("$totalMB",1,".");
  $dotpos= strpos($totalMB,".",0);
  $integer= substr ($totalMB,0,$dotpos);
  $decimal=substr ($totalMB,$dotpos,3);
  $totalMB="$integer$decimal";
  
  $getGB= gettoken ("$totalGB",1,".");
  $dotpos= strpos($totalGB,".",0);
  $integer= substr ($totalGB,0,$dotpos);
  $decimal=substr ($totalGB,$dotpos,3);
  $totalGB="$integer$decimal";          
*** */  
I have tested the result, and found no problems.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

Thanks PeterH, your comments are very helpful. I figured that part (<0.01) too yesterday and got rid of it because i dont like it. :)
And indeed your code is shorter. Initially i had made my script to include both "," and "." with IF conditions but decided to stay with just "." and forgot to clean-up later.

v2.4 comes

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

DiskManager_v.2.4

-Fixed some problems
-Included breadcrumb style path (quicker navigation to parent folders)
-changed some font colors and highlighting.

Download:
DiskManager_v2.4.xys
(7.02 KiB) Downloaded 198 times

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: DiskManager

Post by PeterH »

serendipity wrote:Thanks PeterH, your comments are very helpful. I figured that part (<0.01) too yesterday and got rid of it because i dont like it. :)
And indeed your code is shorter. Initially i had made my script to include both "," and "." with IF conditions but decided to stay with just "." and forgot to clean-up later.

v2.4 comes
Bitte schön! Es hat Spaß gemacht! :D
In English this is: you are welcome - and I enjoyed it!
Glad you accept it - I know of people getting angry in such situations :o
But when I saw what you did from XY-script it was temptation enough to look inside! The best exercise to get a bit into XY-scripting :roll: Sad to say I have *very* little html-knowledge. I can read it a bit, but could never construct such a window...

To V2.4:
OK - arithmetic seems correct now.
And the coloring of the units is great. Only MB & GB could differ a bit more.
But the color of the Size(%) is *much* too weak! While I still think the coloring of bar makes not much sense - and lets Size(%) look still more pale. (Or is this a problem of my display?)
The breadcrumb is really great! Now you could delete the ^Up^ "buttons"? (You see: I don't like them - they disturb the picture :( )

The result: very good, only some peanuts left. (Unless you have new ideas :P )

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

PeterH wrote:
serendipity wrote:Thanks PeterH, your comments are very helpful. I figured that part (<0.01) too yesterday and got rid of it because i dont like it. :)
And indeed your code is shorter. Initially i had made my script to include both "," and "." with IF conditions but decided to stay with just "." and forgot to clean-up later.

v2.4 comes
Bitte schön! Es hat Spaß gemacht! :D
In English this is: you are welcome - and I enjoyed it!
Glad you accept it - I know of people getting angry in such situations :o
But when I saw what you did from XY-script it was temptation enough to look inside! The best exercise to get a bit into XY-scripting :roll: Sad to say I have *very* little html-knowledge. I can read it a bit, but could never construct such a window...

To V2.4:
OK - arithmetic seems correct now.
And the coloring of the units is great. Only MB & GB could differ a bit more.
But the color of the Size(%) is *much* too weak! While I still think the coloring of bar makes not much sense - and lets Size(%) look still more pale. (Or is this a problem of my display?)
The breadcrumb is really great! Now you could delete the ^Up^ "buttons"? (You see: I don't like them - they disturb the picture :( )

The result: very good, only some peanuts left. (Unless you have new ideas :P )
Thanks again for your comments.
I am always undecided about colors, they look so different on different PCs. Anyway, made some more changes.
I think I will stick with bar colors for now, but I understand what you mean.
I might color them depending on percentage rather than size. Experimenting on some stuff.
And, yes with my latest version (v2.5) here ^UP^ will go because i have something else in store (not because it disturbs you :wink: ).

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: DiskManager

Post by PeterH »

serendipity wrote: Thanks again for your comments.
I am always undecided about colors, they look so different on different PCs. Anyway, made some more changes.
I think I will stick with bar colors for now, but I understand what you mean.
I might color them depending on percentage rather than size. Experimenting on some stuff.
And, yes with my latest version (v2.5) here ^UP^ will go because i have something else in store (not because it disturbs you :wink: ).
A short one this time: Bars colored by % could be first class :D

And to the selection of colors: it's easy for me to say those don't display as good as they should - but it's hard for me, too, to select them better :(

Yes, the UPs disturb me - but I asked to delete them because breadcrumb can do this better :roll: :roll:

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

DiskManager_v2.5
- Now usersettings will be written to Datamanager.ini (not to self).
- Includes JumpTo dropdown menu.
- Bar graph gradient color based on %.
- Changed Size colors (hope they are better now)
- User can now specify a range for "Highlight Size column".

Download:
DiskManager_v2.5.xys
(10.96 KiB) Downloaded 209 times

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: DiskManager

Post by j_c_hallgren »

serendipity wrote:DiskManager_v2.5
- Now usersettings will be written to Datamanager.ini (not to self).
- Includes JumpTo dropdown menu.
- Bar graph gradient color based on %.
- Changed Size colors (hope they are better now)
- User can now specify a range for "Highlight Size column".
I've been reading this thread but hadn't tried this script until now...and...

Unfortunatelyfor a first time user, it didn't quite work as I had expected! :(

On XY 8.80 (a bit behind not not much), I saved it to my Script folder and executed it via Scripting>Load Selected Script...what I got was a tiny box that barely gave me room to see what it was asking for...anyway...pointed it to "My Doc" and said "go"...it crunched for a bit but when it said "Done"...I still couldn't see anything! :cry:

Here's all I saw:
Attachments
SS - XY Disk Mgr.jpg
SS - XY Disk Mgr.jpg (16.76 KiB) Viewed 2806 times
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

admin
Site Admin
Posts: 64834
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: DiskManager

Post by admin »

j_c_hallgren wrote:On XY 8.80 (a bit behind not not much)...
8.80.0000 is not enough for this script. Try the latest beta...

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: DiskManager

Post by j_c_hallgren »

admin wrote:
j_c_hallgren wrote:On XY 8.80 (a bit behind not not much)...
8.80.0000 is not enough for this script. Try the latest beta...
Ok..
But there was no comments that I saw with min vers rqmt so figured the current Official would be adequate...some other scripts have a warning somewhere, either here in forum, in the script or via msg.

Addendum: serendipity, I must admit, however, that i am quite impressed with what you've been able to do with this! 8)

Request: The font used for the filenames is not one that I normally use and as such is a bit less than ideal...is there a simple way to specify that or could that be retrieved from other INI/Config settings automatically by the script?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

j_c_hallgren wrote:But there was no comments that I saw with min vers rqmt so figured the current Official would be adequate...some other scripts have a warning somewhere, either here in forum, in the script or via msg.
Apologies, I should have added a check there, something like this:
end (<xyver> < 8.80.0001), "Ooops! you are on version <xyver>. <crlf> Minimum required version for this script is v8.80.0001.";
j_c_hallgren wrote: Addendum: serendipity, I must admit, however, that i am quite impressed with what you've been able to do with this! 8)
Thanks, I am glad you like it. Had free time over Xmas. :D . And, got some good feedback from PeterH. Yours is welcome too.
j_c_hallgren wrote: Request: The font used for the filenames is not one that I normally use and as such is a bit less than ideal...is there a simple way to specify that or could that be retrieved from other INI/Config settings automatically by the script?
I will see if its possible to get user colors here.

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: DiskManager

Post by PeterH »

serendipity wrote:DiskManager_v2.5
- Now usersettings will be written to Datamanager.ini (not to self).
- Includes JumpTo dropdown menu.
- Bar graph gradient color based on %.
- Changed Size colors (hope they are better now)
- User can now specify a range for "Highlight Size column".

Download:
DiskManager_v2.5.xys
What should I say? Really great!

But as you know: I've got some problems :roll:

1) Don alowed to move the script directory - and I have done that, to another drive.
DiskManager tries to write some files to old location - no directory - fails :?
I've created an empty dir under Appdata - now it functions. But this is not as it should work. I hope Don creates a new var <xyscript> pointing to the correct script-directory.
While, for the .ini, you probably shouldn't take xy-script-dir, but the dir where DiskManager resides in? (This *could* be different!) As Stefan said (in other thread): self("path") is path of current script.
For the tempfile I'm not sure what to take: the same or xy-script-file. Maybe it doesn't matter, it's deleted anyway...

2) Don made the window resizable. I'm afraid you can't be notified and write the new size to your .ini? (So I must edit it "by hand".)
But ok - on V2.6 ( :lol: ) it will use the currently defined - so I must not change it again on every new version...

3) I'm afraid I see no bar :shock:
Oh - just reviewed it: There is no bar - but if I mark the area, I suddenly see something? Is it possible the bar (at least for me) is in the color of the background?

4) Size% is highlighted in green, if between the two values. Shouldn't it be red (or so) if it's above?

But one more saying to the script: it's unbelievable, what you can do with the combination of XY-scripting and html. Very very remarkable!

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: DiskManager

Post by PeterH »

Oh - I forgot:

5) the JUMP TO shows the names in english ("Program Files"), while in german it's "Programme".
It would be better if you could somewhere get the local names for these. But i's not a must - only candy. (As I think everyone here understands what is meant.)

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

PeterH wrote:3) I'm afraid I see no bar :shock:
Oh - just reviewed it: There is no bar - but if I mark the area, I suddenly see something? Is it possible the bar (at least for me) is in the color of the background?
Quickly:
What do you mean by no bar! You mean no bar graph?? It should be a gradient between orange to red. or you are referring to something else?
Will answer others later.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: DiskManager

Post by serendipity »

1) XY Script directory:
Yes, self("path") was the first thing i thought about when i saw the beta today.
4) Size% is highlighted in green, if between the two values. Shouldn't it be red (or so) if it's above?
I changed the logic, anything in between those values will be highlighted. Thats why its not called threshold anymore.
But one more saying to the script: it's unbelievable, what you can do with the combination of XY-scripting and html. Very very remarkable!
Thanks! :D

Post Reply