SafeUnplug

Title SafeUnplug
File Name SafeUnplug.txt
Description Safely unplug any USB device
Author Vochomurka
Parameters -
Plugins Called win, childwin, tc
Icon
Version 1.1
Updated on 05.06.2008
local Flash = "f"
local SafePath = "c:\"
local hwnd = win.handle("c=TTOTAL_CMD")
local TMPl = childwin.handle(hwnd, "TMyPanel", 2)
local TMPr = childwin.handle(hwnd, "TMyPanel", 3)
local TMTCl = childwin.handle(TMPl, "TMyTabControl")
local TMTCr = childwin.handle(TMPr, "TMyTabControl")
local LeftPath = childwin.gettext(TMTCl, "TMyPanel", 2)
local RightPath = childwin.gettext(TMTCr, "TMyPanel", 2)
if(not find(LeftPath, Flash))
	tc.cd(hwnd, "left", SafePath)

if(not find(RightPath, Flash))
	tc.cd(hwnd, "right", SafePath)

do("path to application that unplugs", "parameters")

Comments:

This script is written by request of one of users. Just replace the "f" letter (variable Flash) to the drive letter of USB for your computer. Then in the last script line put the full path to the application that performs the unplugging, and parameters, if any. For example, I use the following line:

do("d:\Utils\DevEject\deveject.exe", "-EjectDrive:f:")

If one or both Total Commander panels correspond to the USB path, it will be first changed to "c:\" path that is always valid, and only afterwards the very unplugging command is executed. It allows to avoid the "Drive not found" error message.


Main Page Total Commander PowerPro