I use a CTRL + SHIFT + ALT + as command to eject a certain drive letter. Unfortunately the icon in the drive letter toolbar doesn't disappear. Instead an error message is shown if I click the icon. It would be much more convenient if the command Go U: EJECT lets the drive icon disappear. Otherwise the user doesn't have any feedback about the success of the operation.
If you push F5 (refresh) afterwards, does the toolbar update?
If not, is the drive still there if you close the window and open a new one?
[quote="leo"]If you push F5 (refresh) afterwards, does the toolbar update?
If not, is the drive still there if you close the window and open a new one?[/quote]
The drive is still shown even if I restart DOpus as well as in the Windows Explorer. The tooltip in DOpus says the drive has "no medium".
I looks as the EJECT command doesn't do the same as the Windows eject icon in the system tray!?
I would recommend that the eject command on a CD/DVD drive actually ejects the medium but if the command is called on an USB-Stick the device should be dismounted --- instead of the medium (of the USB-Stick ).
You can easily reproduce that issue as follows:
- Connect an USB-Stick (Before-Eject.png)
- Eject the USB-Stick using DOpus "Go EJECT M:" command (After-Eject-DOpus.png)
- Eject the USB-Stick using Windows systray icon (After-Eject-Windows.png)
Sorry the images have to be in reverse order.
The Go EJECT command is equivalent to right clicking on the drive and choosing Eject from the context menu.
Ah ok, now it gets clearer.
What is the correct command to dismount an USB-Stick by a hotkey?
I´ve hoped that I can configure a hotkey (bound to CTRL+ALT+SHIFT+) that ejects disc drives but unmounts USB-Sticks.
In other words I want to use a hotkey for each drive-letter A..Z that can be used to easily eject disc drives and unmount USB-Sticks on several machines (using DOpus in traveller mode) by just pressing a global hotkey for the drive letter.
There isn't one built into Opus.
You can use DriveRemove.exe from the Drive Tools for Windows set of tools, if you want to automate the safely remove hardware tray menu that is part of Windows. It works well within Opus buttons.
At least at the website it sounds as I have to decide (by argument) whether I want to remove or eject a drive. Thus it may be difficult to get a single hotkey in DOpus that ejects drives and removes USB-sticks (depending of the type of the drive).
I will give it a try, maybe it can be done by evaluating the result code and call DriveRemove with different arguments in a sequence.
Thanks for this hint.
I think (safely) removing a drive implies ejecting it as well (for drive types which can be ejected). Otherwise it wouldn't be a safe removal.
RemoveDrive has a certain argument that ejects the media if a removal failed:
[-e] try to dismount and eject if the removal fails
That works for me now, anyway it would be nice to have a Go DISMOUNT=ejectonerror command in DOpus.
Just a note:
I recently figured out that there is no "@iferr:" command modifier that can be used to execute a command conditionally if the previous (external) command returned with an errorlevel. RemoveDrive returns different errorlevels for different failures. For some failures I want to display a DOpus message box, thus it wold be nice to have such an "@iferr" command modifier to avoid going the reverse way using a dopusrt from an external script.
Thanks, seems like a good idea!
You could probably work around this for now by doing the whole command as a .bat script.
I think I will use wscript, otherwise I won't be able to give feedback to the user by using a message box.
By the way: I would appreciate to have a simple command to display message boxes (of different types) without any user input fields (for informational purposes only).
{dlg|error|Drive can not be removed (seems to be locked).}
{dlg|info|Drive successfully removed.}
You can get Opus to show a message box using dopusrt (although the command will be asynchronous so you can't receive the result of the dialog):
dopusrt.exe /cmd @confirm Error!
Is it possible to get a message box without a "cancel" button to display an information text only?
Yes, use Error!|OK instead of just Error!
Other details about @confirm can be found here: Command modifier reference.
However, if you are using VBScript, why not use VBScript's own message box function, MsgBox? (Alternative guide.) That is probably better.