Eject USB flash disk

Is it possible to add a RMB function on the USB flash disk letter in order to safely unplug the USB drive ? :slight_smile:

It could be useful instead of having to deal with the icon in the windows taskbar...

I would like this feature, too! But with MMB (Dual!) :slight_smile:

Also an "exit'n'unplug" option when using DO on USB would be great!

Does this work?

resource.dopus.com/viewtopic.php ... ight=eject

I haven't tried it with USB devices (and I dare not try it as my Vista/nForce680i machine seems prone to bluescreening when USB drives are plugged in more than once per reboot, ARGH!!) but it should work, assuming they have an Eject option on their context menus.

You should be able to change the example button to use {filepath} or {sourcepath} (depending on the context that the button is run in) instead of D:\ to make it work with any drive letter.

unfortunaly, this doesn't work :frowning:

Just tried it, the result : the disk is still displayed in explorer, but I can't even "safely unplug" it with the taskbar icon :
"this drive is accessed by another application".

This thread mentions a removedrive.exe tool that sounds like it will do the job as part of an Opus context menu:

resource.dopus.com/viewtopic.php ... =usb+eject

Looks like these's some more/alternative suggestions here:

portableapps.com/node/639

nice.

It seems perfect, will test it tonight.

Thx :sunglasses:

hum, trying to test a three button with a Drive button, the drive button doesn't like it.
He doesn't display anymore the drive letters one I set it to a three button.

Plus, the drive A: (floppy) is still displayed even if empty :[

Go DRIVEBUTTONS=hideempty,+ae

Hideempty ignores floppy drives as Windows doesn't detect when disks are inserted. (To detect it Opus would have to check the drive every few seconds, resulting in a really annoying Amiga-style click.)

lol, ok.

Shame on XP :slight_smile:

an even better solution is the removedrive tool found at uwe-sieber.de/files/removedrive.zip

This tool clears the drive cache and unplugges it. If it fails to do so, it will retry the specified times (see help command -h).

You can run it via a batch file or from opus like this:

PATH_TO\RemoveDrive\RemoveDrive.exe "TOSHIBA MK3018GAS" -l -w:1000

Instead of supplying the drive identification string (TOSHIBA ...) you can just add the drive letter. But this is the easiest way because determining the right drive letter is an very difficult task in DOpus/Batch file.

Greetings,
Benjamin

many thanks BenjaminW

i try to replace devive's name by letter.
so i try "/home.." (for me x:) but program doen't want the last [b][/b]
is there a way to skip [b][/b] ?

[quote="AlbatorIV"]many thanks BenjaminW

i try to replace devive's name by letter.
so i try "/home.." (for me x:) but program doen't want the last [b][/b]
is there a way to skip [b][/b] ?[/quote]

For {destpath} etc. there is IMHO a modifier for this, I think. But I don't know how to accomplish this for that hardcoded path. Using the device name would be easier unless someone knows a way to retrieve the actual drive letter (without trailing slash) of the place where DOpus resides.

To retrieve the device name just open the dialog where you usually disable your USB devices (doubleclick on the icon with the green arrow located in the system tray). Make sure you enable the display of the device components at the bottom of the dialog (I'm not sure how it is called exactly, I'm using a localized version of Windows in German). See the screenshot for details.

I hope this helps.

Greetings,
Benjamin

[quote="AlbatorIV"]i try to replace devive's name by letter.
so i try "/home.." (for me x:) but program doen't want the last [b][/b]
is there a way to skip [b][/b] ?[/quote]

How were you passing the path to the program?

{alias|home..} will literally include the ".." in the output which probably would confuse the program.

{alias|home|..} will turn into the parent of the home directory. It will still have a slash on the end so if the program is confused by that then it still won't work. I just thought it worth checking that you were not inadvertently passing a string with ".." to the program.

There is also {alias|home|noterm} which will turn into the home directory without the slash. Unfortunately you can't use both |noterm and |.. at once (the second one gets ignored) but I have filed a feature request asking for this possibly to be supported.

Here's my button that closes DO and disables the drive to safely remove it (DO 9!):

<?xml version="1.0"?> <button display="both" label_pos="right" separate="yes"> <label>Exit and remove drive!</label> <tip>Exit Directory Opus and disable the drive for safe removal</tip> <icon1>#default:exit</icon1> <function type="normal"> <instruction>@confirm </instruction> <instruction>/home\..\..\TOOLS\RemoveDrive\RemoveDrive.exe &quot;TOSHIBA MK3018GAS&quot; -l -w:1000</instruction> <instruction>Close PROGRAM</instruction> </function> </button>

Notice the \home....\ Path. That's what I'm using and it works just fine on every system I tried it. But as AlbatorIV noted it's not possible to retrieve the drive letter of the USB device to supply it to removedrive.exe. My way is to just supply the device ID which is unique on the most systems IMHO.

Greetings,
Ben

I find this freeware to eject usb device : USB Disk Ejector
quick.mixnmojo.com/usb-disk-ejector

[code]
What is USB Disk Ejector?:
A program that allows you to quickly remove USB devices in Windows. It was originally designed to remove only USB pen drives but will now eject any USB device. It can be run as a non-visual command line program or a normal gui program.

The command line options are very flexible, they can be used to:

Eject the drive that the program is running from.
Eject a drive by specifying a drive letter.
Eject a drive by specifying a drive name.
Eject a drive by specifying a partial drive name.
Its very useful if you have a USB flash/pen drive, especially if you use a menu such as PStart or the Portable Apps launcher. With one click the menu will exit, the program will run silently and the drive will be ejected. See the 'Command Line Options' section below for more information.

When run as a 'normal' GUI program the tools enables USB devices to be quickly ejected through a mouse click or keyboard press. It's especially useful when dealing with multiple USB devices and for Vista users who don't want the 'now safe to remove this device' dialog box to appear.

Command Line Options:

The following command line options are available:

/?
Displays a dialog that shows all command line options.

/SILENT
Stops balloon messages from appearing when the program is run in GUI mode.

/SHOWEJECT
Shows the standard ''It is now safe to now safe to remove'' message when a drive is ejected. This message is disabled by default.

/REMOVETHIS
Ejects the drive that the program is running from. Eg if the program is run from a usb stick on drive G then drive G would be ejected.

/REMOVELETTER
Ejects the specified drive letter. Eg /REMOVELETTER G

/REMOVENAME
Ejects the drive with the specified name. Eg /REMOVEDRIVE "Sandisk U3 Titanium"
Partial name matching is possible if a wildcard (*) is used. Eg /REMOVENAME "*SANDISK" would eject a drive that had Sandisk in its name.[/code]
Info: quick.mixnmojo.com/readmes/USBDiskEjector.html

Hello,

After all, has anyone found a solution to this? I'd really love to have a button that would safely remove the usb in the active pane, or (alternatively) remove it through its RMB...

Did you try the tool AlbatorV posted? To remove the current drive you should be able to use something like this, I guess (not tested):

@set driveletter = {sourcepath$|\} Go /mycomputer "C:\wherever\it\is\installed\USB_Disk_Eject.exe" /REMOVELETTER {$driveletter}
Assuming the tool doesn't mind being given letters like "G:" rather than just "G", which hopefully it doesn't. If not a bit of VBScript glue or something could be used to remove the ":"

Maybe the /REMOVETHIS command would also work, without the other two. Depends if it needs Opus to release the drive before it can eject it or not.

Yes, I have tried using it (last version released a week ago! what are the chances? :slight_smile: ), but didn't manage to get it working. ATM I've just got a command button to run it and remove the specific flash drive I use. But I think it'd make a lovely feature for a next DO release...

[quote="leo"]Did you try the tool AlbatorV posted? To remove the current drive you should be able to use something like this, I guess (not tested):

@set driveletter = {sourcepath$|\} Go /mycomputer "C:\wherever\it\is\installed\USB_Disk_Eject.exe" /REMOVELETTER {$driveletter}
Assuming the tool doesn't mind being given letters like "G:" rather than just "G", which hopefully it doesn't. If not a bit of VBScript glue or something could be used to remove the ":"

Maybe the /REMOVETHIS command would also work, without the other two. Depends if it needs Opus to release the drive before it can eject it or not.[/quote]