** Reply to message from Paul Breezeon Tue, 13 Dec 2005 11:37:39 GMT Paul: You wrote that Unplug or Eject Hardware lists these three lines: USB Mass Storage Device Ut161 USB2FlashStorage USB Device Generic Volume - (F:) > I think the middle line is the one you are looking for." I agree. We don't want to Stop the adapter, just the peripheral. I'm assuming Win2000. Enclosed, a script (BREEZE.GO) that should auto-close the device (this particular script is probably not transferable to any other OpSys, although the concept is). Run from XyWrite, it will close the device and then _return_ to XyWrite, hands-off -- you could Stack the command above, or make it a U2 command, or put it in your KBD file, whatever (auto-Stacking it via STARTUP.INT is by far the easiest thing to do). You need a fresh copy of GoXy.EXE from XyWWWeb (http://users.datarealm.com.xywwweb/Go.ZIP), positioned in C:\WINNT\system32. Use the attached scriptfile, but here's a description of how it works (lines beginning with "///" are comments): ----------------------- /// Issue a DOS command line like this: /// GoXy.exe C:\XY4\BREEZE.GO "" c /// On XyWrite's CMline: /// dos/nv/x/z /c GoXy.exe C:\XY4\BREEZE.GO "" c key(LW)rkey(WT{500}) LeftWindow key, R (=Run dialog). WaiT .5 seconds (500ms) RunDLL32.exe shell32.dll,Control_RunDLL hotplug.dllkey(ET) Issue above command, hit EnTer key key(WT{1000}L1WT{500}JW{Ut161 USB2FlashStorage})key(WT{500}RD)key(IF{TD=Ut161:G2})key(JW{Unplug or Eject Hardware}CDG1L2) WaiT 1 second, mark position in script with Label#1, WaiT .5 seconds for "Unplug or Eject Hardware" dialog to appear (it can take quite a while). Jump_to_ChildWindow titled "Ut161 USBFlashStorage...". WaiT .5 secs. Reset GoXy's notion of the Default (i.e. currently-focused) window to the current window. If the DefaultTitle (i.e. the single line in the big box -- this is a "window" according to M$) includes sub$tring "Ut161", then GotoLabel#2 (i.e. "L2" at LineEnd); *otherwise* Jump_to_Top-Level Window "Unplug or Eject Hardware", Cursor Down one line, and Go back to Label#1. In short, keep looping and cursoring down one line until you find the line that says Ut161. Finally, Label#2 -- this is where you are if you earlier found the line called "Ut161 USBFlashStorage". That's a lot of logic expressed very pithily. Harry wouldn't call it "sensible". But it's powerful. key(AL)skey(WT{1000}ETWT{1000}ETWT{1000}AL)ckey(WT{1000}ET) We've found your device. Stuff ALt-S ("Stop" it). WaiT 1 sec, hit EnTer. WaiT 1 second twice (you need to wait for Windows to act! shutting down a device is not trivial), hit EnTerkey at two confirmation windows, then ALt-C to "Close" the dialog, then another confirmation to close all windows. key(JW{TO}) JumpWindow to TitleOriginal, which is "XYWRITE" (assumed to be a case-INsensitive substring of your XyWrite WindowTitle, whatever it is, e.g. "XyWrite IV"). ---------------------- That's what the word "de-scription" means, not that anyone ever thinks about it. This script engine is designed for the short DOS (or XyWrite) command line, so the syntax is compact (and unforgiving). All commands are just two characters. What's interesting about it is that it can do just about anything your fingers can do -- and more. For example, if your keyboard is missing certain keys, Go can supply them. The downside is that there's no one-size-fits-all; each script pretty much needs to be tailored to each box. You may need to lengthen the WaiT times, depending on machine speed or max number of attached devices. You can step through (debug) the script by putting comments (///) after complete "phrases", mostly after close parentheses. See Go.HTM in the ZIPfile for more, if you're curious. Give it a whirl. Theoretically, it will work as-is. ----------------------------- Robert Holmgren holmgren@xxxxxxxx ----------------------------- Attachment: BREEZE.GO
Description: Binary data