Drive space left shown in menu

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Eep²
Posts: 33
Joined: 28 Mar 2012 19:58

Drive space left shown in menu

Post by Eep² »

Years (probably at least a decade now) ago I used Directory Opus and it's drives toolbar showed each drive's free space without having to right-click on the drive and choose properties or left-click the drive to go to it and see the space left in the status bar. Is there a way to have XYplorer show a drive's free space in its "System" toolbar menu?

Eep²
Posts: 33
Joined: 28 Mar 2012 19:58

Re: Drive space left shown in menu

Post by Eep² »

I guess not possible?

highend
Posts: 14639
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Drive space left shown in menu

Post by highend »

You mean show it "all the time" without user interaction? No.

A bit easier maybe:

Code: Select all

    $drives = get("drives", , <crlf>);
    $log = "";
    foreach($drive, $drives, <crlf>, "e") {
        //$name = get("drivename", $drive, 0);
        $free = formatbytes(get("freespace", $drive, 1));
        //$log .= $drive . " - " . $name . " [Free: " . $free . "]" . <crlf>;
        $log .= $drive . " [Free: " . $free . "]" . <crlf>;
    }
    $sel = popupmenu($log, 6:=<crlf>);
    if ($sel) { goto gettoken($sel, 1, " "); }
One of my scripts helped you out? Please donate via Paypal

Eep²
Posts: 33
Joined: 28 Mar 2012 19:58

Re: Drive space left shown in menu

Post by Eep² »

Thanks, highend, but the script window gives "The device is not ready." when I run your script.

highend
Posts: 14639
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Drive space left shown in menu

Post by highend »

Show a screenshot of that message and which kind of drive is that (removable, CD-ROM, mapped drive, ...)?
One of my scripts helped you out? Please donate via Paypal

RalphM
Posts: 2051
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Drive space left shown in menu

Post by RalphM »

I get the same message twice, once for a BD-RE drive (E:/ w/o a disc inserted) and the second for a mapped external drive which is currently not connected to my NAS (N:/) and results in the following pop-up:
PicPick_530.jpg
PicPick_530.jpg (30.03 KiB) Viewed 2115 times
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

highend
Posts: 14639
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Drive space left shown in menu

Post by highend »

Run

Code: Select all

text get("drives", 0, <crlf>);
text get("drives", 1, <crlf>);
...
text get("drives", 6, <crlf>);
In other words from 0 up to 6 one after another and tell me
if E:\ is listed when you use 2 (and not anywhere else)
and on which value you see the N:\ drive
One of my scripts helped you out? Please donate via Paypal

RalphM
Posts: 2051
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Drive space left shown in menu

Post by RalphM »

0 -> None
1 -> N:/
2 -> None
3 -> C:/ and D:/
4 -> G:/, M:/ and Z:/ (all mapped drives on the same NAS)
5 -> E:/
6 -> None
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

highend
Posts: 14639
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Drive space left shown in menu

Post by highend »

Ok,

then use this one and if you don't have drives of that types or don't want to query them, set their value to false instead of true:

Code: Select all

    $useRemovable = true;
    $useRemote    = true;

    $drives = get("drives", 3, <crlf>); // Fixed drives
    if ($useRemovable) { $drives .=  <crlf> . get("drives", 2, <crlf>); }
    if ($useRemote)    { $drives .=  <crlf> . get("drives", 4, <crlf>); }
    $drives = formatlist($drives, "sed", <crlf>);

    $log = "";
    foreach($drive, $drives, <crlf>, "e") {
        //$name = get("drivename", $drive, 0);
        $free = formatbytes(get("freespace", $drive, 1));
        //$log .= $drive . " - " . $name . " [Free: " . $free . "]" . <crlf>;
        $log .= $drive . " [Free: " . $free . "]" . <crlf>;
    }
    $sel = popupmenu($log, 6:=<crlf>);
    if ($sel) { goto gettoken($sel, 1, " "); }
One of my scripts helped you out? Please donate via Paypal

RalphM
Posts: 2051
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Drive space left shown in menu

Post by RalphM »

Works good enough for me and doesn't give any error messages anymore even with "$useRemovable = true".
Let's hear if the OP is happy as well, as I was just helping with my results.
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

Eep²
Posts: 33
Joined: 28 Mar 2012 19:58

Re: Drive space left shown in menu

Post by Eep² »

Yes, that works; thanks. Now I'll try to figure out how to add total space and see if there's a way to have it always show in the toolbar instead of having to click a button...

Trying to add used space but all that happens is "Drives" pops up. Any ideas what I'm doing wrong?

Code: Select all

    $useRemovable = true;
    $useRemote    = true;

    $drives = get("drives", 3, <crlf>); // Fixed drives
    if ($useRemovable) { $drives .=  <crlf> . get("drives", 2, <crlf>); }
    if ($useRemote)    { $drives .=  <crlf> . get("drives", 4, <crlf>); }
    $drives = formatlist($drives, "sed", <crlf>);

    $log = "";
    foreach($drive, $drives, <crlf>, "e") {
        //$name = get("drivename", $drive, 0);
        $free = formatbytes(get("freespace", $drive, 1));
        $used = formatbytes(get("usedspace", $drive, 1));
        //$log .= $drive . " - " . $name . " [Free: " . $free . "]" . <crlf>;
        $log .= $drive . " [Used: " . $used . ", " . Free: " . $free . "]" . <crlf>;
    }
    $sel = popupmenu($log, 6:=<crlf>);
    if ($sel) { goto gettoken($sel, 1, " "); }
I'd also like to have the drive volume name show in the list.
Last edited by Eep² on 10 Sep 2020 23:14, edited 1 time in total.

highend
Posts: 14639
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Drive space left shown in menu

Post by highend »

get() knows "usedspace" as well...
if there's a way to have it always show in the toolbar instead of having to click a button...
That's not possible with XY scripting. You would need to write an external tool for this
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4408
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Drive space left shown in menu

Post by klownboy »

You were missing a quote. This adds drivename to the listing.

Code: Select all

    $useRemovable = true;
    $useRemote    = true;

    $drives = get("drives", 3, <crlf>); // Fixed drives
    if ($useRemovable) { $drives .=  <crlf> . get("drives", 2, <crlf>); }
    if ($useRemote)    { $drives .=  <crlf> . get("drives", 4, <crlf>); }
    $drives = formatlist($drives, "sed", <crlf>);

    $log = "";
    foreach($drive, $drives, <crlf>, "e") {
        //$name = get("drivename", $drive, 0);
        $free = formatbytes(get("freespace", $drive, 1));
        $used = formatbytes(get("usedspace", $drive, 1));
        $drivename = get("drivename", $drive,"0");
        //$log .= $drive . " - " . $name . " [Free: " . $free . "]" . <crlf>;
       // $log .= $drive . " [Used: " . $used . ", " . " Free: " . $free . "]" . <crlf>;
        $log .= $drive . " (" . $drivename . ")" . " [Used: " . $used . ", " . " Free: " . $free . "]" . <crlf>;
    }
    $sel = popupmenu($log, 6:=<crlf>);
    if ($sel) { goto gettoken($sel, 1, " "); }

Eep²
Posts: 33
Joined: 28 Mar 2012 19:58

Re: Drive space left shown in menu

Post by Eep² »

Thanks.

Post Reply