CaptKen Posted February 11, 2016 Posted February 11, 2016 I have put together the script below to format a Thumb Drive when inserted. It works pretty good but I would like to automate it further. Right now the prompt to hit "enter" stops the process. I would like the script hit enter. I have tried using the Send("{enter}") command in different lines but it does not seem to work no matter where it put it. I have also tried to pause the script to give the window time to open with the "Sleep" command but also no luck. Here is the script. If anyone has any ideas I would appreciate it. Thanks. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $DBT_DEVICEARRIVAL = "0x00008000" $WM_DEVICECHANGE = 0x0219 GUICreate("") GUIRegisterMsg($WM_DEVICECHANGE , "MyFunc") Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam) If $WParam == $DBT_DEVICEARRIVAL Then RunWait(@comspec & " /c format/q /v:Hartford E:","") EndIf EndFunc While 1 $GuiMsg = GUIGetMsg() WEnd usb insert.au3
rudi Posted February 11, 2016 Posted February 11, 2016 Hi. Try the additional option " /y" for format.exe As well you could use powershell instead of format.exe. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
CaptKen Posted February 13, 2016 Author Posted February 13, 2016 Thanks Rudi !! the "/y" did the trick !
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now