Every time I'll have to close the corresponding tabs before ejecting portable devices,
Can I eject flash cards or memory sticks smoothly and close the tabs automatically?
Have to close tabs before ejecting devices
Forum rules
You might want to read this if you're looking for priority service
Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
You might want to read this if you're looking for priority service
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
-
ojcuts
- Posts: 54
- Joined: 03 Feb 2013 15:15
Have to close tabs before ejecting devices
To see the attached files, you need to log into the forum.
ze ojc uts
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Have to close tabs before ejecting devices
Use a script...
a.) Adapt the path for the RemoveDrive.exe to your local system (and bitness!)
b.) It will only check all tabs in the active pane^^
Code: Select all
// RemoveDrive: http://www.uwe-sieber.de/drivetools_e.html
$driveLetter = inputselect("Select the drive to eject:", get("drives", 2));
$tabCount = tab("get", "c"); // Only for the active pane
while (true) {
$tab = tab("get", "path", $tabCount);
if (substr($tab, 0, 3) == $driveLetter) {
tab("close", 0, $tabCount);
}
$tabCount--;
if ($tabCount == 0) { break; }
}
run """D:\Users\Highend\Downloads\removedrive\x64\RemoveDrive.exe"" $driveLetter", , 2, 0;
b.) It will only check all tabs in the active pane^^
One of my scripts helped you out? Please donate via Paypal
-
klownboy
- Posts: 4481
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440
Re: Have to close tabs before ejecting devices
Hi highend,
I like your script to close an external drive's tab and remove the drive. Many times though I (and maybe some others) just want to simply "clean house" and close all unlocked tabs when removing an external drive. Which is actually far easier to do. I have my C:\ set as the "default tab" so I tend not to have a bunch of unlocked tabs floating around.
The command, #352 closes all "other" unlocked tabs only, not the tab you have currently selected. There's where Don's new "flags" paramenter comes in handy (I was trying to find a use for it). With that, we can now determine if the tab is unlocked and close it. The get "flags" parameter will return null("") if it's unlocked. The script below will also not provide an inputselect box if you only have "one" external drive on line. It will simply close all unlocked tabs and remove the external drive. If there's more than one you choose which one to eject. I also added the -b parameter to provide a little built-in Windows notification that the drive has bee removed. By the way, there are some AHK functions out there which we could use to eject the drive if we wanted to in lieu of using "removedrive.exe". I already had removedrive.exe in my Tools folder anyway.
How's alt-tab doing?
Thanks,
Ken
I like your script to close an external drive's tab and remove the drive. Many times though I (and maybe some others) just want to simply "clean house" and close all unlocked tabs when removing an external drive. Which is actually far easier to do. I have my C:\ set as the "default tab" so I tend not to have a bunch of unlocked tabs floating around.
The command, #352 closes all "other" unlocked tabs only, not the tab you have currently selected. There's where Don's new "flags" paramenter comes in handy (I was trying to find a use for it). With that, we can now determine if the tab is unlocked and close it. The get "flags" parameter will return null("") if it's unlocked. The script below will also not provide an inputselect box if you only have "one" external drive on line. It will simply close all unlocked tabs and remove the external drive. If there's more than one you choose which one to eject. I also added the -b parameter to provide a little built-in Windows notification that the drive has bee removed. By the way, there are some AHK functions out there which we could use to eject the drive if we wanted to in lieu of using "removedrive.exe". I already had removedrive.exe in my Tools folder anyway.
How's alt-tab doing?
Thanks,
Ken
Code: Select all
// RemoveDrive: http://www.uwe-sieber.de/drivetools_e.html
$driveLetter = get("drives", 2), "|");
$Dr_Cnt = gettoken($driveLetter, "count", "|");
end $Dr_Cnt < "1", "You have no removable drives on-line, aborting!";
if ($Dr_Cnt > "1")
{
status "You have more than one flash or external hard drive on-line!";
$driveLetter = inputselect("Select the Target Drive: <crlf>", "$driveLetter", | ,4, ,350, 250, "Target Drive Selection");
}
#352; //close all "other" unlocked tabs
if (tab("get", "flags") == "") { //close the current selected tab if it's unlocked
tab("close", 1)}
#552;#1040;goto "C:\"; //collapses up the tree and gets you back to C:\
run """D:\Tools\RemoveDrive\RemoveDrive.exe"" $driveLetter -b", , 2, 0;
//status "$driveLetter removed. It's safe to unplug it!"; //if you'd rather not have the Win tray notification (remove -b above)-
ojcuts
- Posts: 54
- Joined: 03 Feb 2013 15:15
Re: Have to close tabs before ejecting devices
Script's not working fine,
now my way is to open more computer tabs in one tabset,and close the tab(s) that need to eject,then eject it.
now my way is to open more computer tabs in one tabset,and close the tab(s) that need to eject,then eject it.
ze ojc uts
-
klownboy
- Posts: 4481
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440
Re: Have to close tabs before ejecting devices
Hi ojcuts,
Sorry the scripts aren't working for you. Highend's script as well as the version I posted work fine for me. What error message do you get? Did you download removedrive.exe from the posted URL and change the path to it in the script's run command?
Thanks,
Ken
Sorry the scripts aren't working for you. Highend's script as well as the version I posted work fine for me. What error message do you get? Did you download removedrive.exe from the posted URL and change the path to it in the script's run command?
Thanks,
Ken
-
ojcuts
- Posts: 54
- Joined: 03 Feb 2013 15:15
Re: Have to close tabs before ejecting devices
klownboy wrote:Hi ojcuts,
Sorry the scripts aren't working for you. Highend's script as well as the version I posted work fine for me. What error message do you get? Did you download removedrive.exe from the posted URL and change the path to it in the script's run command?
Thanks,
Ken
Sorry answer so late! Thank you very much for your script! How fool am I that I didn't look deep into the lines! Now I have downloaded removedrive.exe and changed the path, and it works fine.
ze ojc uts
XYplorer Beta Club