Run script from context menu that ejects/unmounts whichever drive was right clicked?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
aminomancer
Posts: 31
Joined: 26 May 2019 06:29

Run script from context menu that ejects/unmounts whichever drive was right clicked?

Post by aminomancer »

I've seen a couple scripts that can eject drives but they just pop-up a dialog asking user to specify which drive out of the full list. But that's not really any different from the "safely remove hardware and eject media" tray icon. What would really be cool is a script that doesn't need to ask you which, you just right click a drive in the tree and click "eject this drive." I feel like this should be possible using almost exactly the same script, but I just don't know how to get the drive letter from right clicking the directory, since that action is performed before the script is actually running. Sorry if I'm being a little vague. What I'm basically talking about is something like how it works on mac OS and some linux distros, where the file explorer shows all the drives in a sidebar and there's an eject icon next to each one, or by right-clicking the drive you can specifically eject the one you right-clicked. This might be too much to do in an xyplorer script, or maybe it requires the script running 24/7, or initiated on right-click or something? But maybe the combination of an AHK script and an xyplorer script could pull this off, AHK to detect where you clicked and send the drive letter to xyplorer, and xyplorer to send the command to hotplug.dll or whatever. And specifically in this case I'm talking about usb drives, hard drives, etc. not optical disk drives. So what I really mean is a script that unmounts the drive, not like the nircmd one that opens/closes a CD drive tray.

Thanks! If anyone else is looking for the same thing, if I do make any progress on this I'll update the thread and share whatever I find.

Post Reply