Drive space left shown in menu
Drive space left shown in menu
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?
Re: Drive space left shown in menu
I guess not possible?
Re: Drive space left shown in menu
You mean show it "all the time" without user interaction? No.
A bit easier maybe:
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
Re: Drive space left shown in menu
Thanks, highend, but the script window gives "The device is not ready." when I run your script.
Re: Drive space left shown in menu
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
Re: Drive space left shown in menu
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:
Ralph 
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)
Re: Drive space left shown in menu
Run
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
Code: Select all
text get("drives", 0, <crlf>);
text get("drives", 1, <crlf>);
...
text get("drives", 6, <crlf>);
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
Re: Drive space left shown in menu
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
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%)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)
Re: Drive space left shown in menu
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:
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
Re: Drive space left shown in menu
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.
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%)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)
Re: Drive space left shown in menu
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?
I'd also like to have the drive volume name show in the list.
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, " "); }
Last edited by Eep² on 10 Sep 2020 23:14, edited 1 time in total.
Re: Drive space left shown in menu
get() knows "usedspace" as well...
That's not possible with XY scripting. You would need to write an external tool for thisif there's a way to have it always show in the toolbar instead of having to click a button...
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
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, " "); }
XYplorer Beta Club