Guest LizJ Posted February 18, 2005 Share Posted February 18, 2005 The following code does not wait until the cmd.exe has been 'killed'. Any ideas? $drivetype=drivegetfilesystem("d:\") if not ($drivetype="ntfs") then Send("{LWINDOWN}{LWINUP}{UP}{UP}{ENTER}") WinWait("Run","Type the name of a p") If Not WinActive("Run","Type the name of a p") Then WinActivate("Run","Type the name of a p") WinWaitActive("Run","Type the name of a p") Send("cmd{ENTER}") WinWait("C:\WINNT\system32\cmd.exe","") If Not WinActive("C:\WINNT\system32\cmd.exe","") Then WinActivate("C:\WINNT\system32\cmd.exe","") WinWaitActive("C:\WINNT\system32\cmd.exe","") Send("convert{SPACE}d{SHIFTDOWN};{SHIFTUP}{SPACE}/fs{SHIFTDOWN};{SHIFTUP}ntfs{ENTER}") WinWait("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") If Not WinActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Then WinActivate("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") WinWaitActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Send("data{ENTER}") WinWait("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") If Not WinActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Then WinActivate("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") WinWaitActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") ProcessClose("cmd.exe") Endif if not ($drivetype="fat32") and fileexists("d:\pharmdb\data") then dircopy("c:\hhcs\database", "d:\pharmdb") EndIf Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 18, 2005 Share Posted February 18, 2005 The following code does not wait until the cmd.exe has been 'killed'. Any ideas?Send("{LWINDOWN}{LWINUP}{UP}{UP}{ENTER}") WinWait("Run","Type the name of a p") If Not WinActive("Run","Type the name of a p") Then WinActivate("Run","Type the name of a p") WinWaitActive("Run","Type the name of a p") Send("cmd{ENTER}") WinWait("C:\WINNT\system32\cmd.exe","") If Not WinActive("C:\WINNT\system32\cmd.exe","") Then WinActivate("C:\WINNT\system32\cmd.exe","") WinWaitActive("C:\WINNT\system32\cmd.exe","") Send("convert{SPACE}d{SHIFTDOWN};{SHIFTUP}{SPACE}/fs{SHIFTDOWN};{SHIFTUP}ntfs{ENTER}") WinWait("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") If Not WinActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Then WinActivate("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") WinWaitActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Send("data{ENTER}") WinWait("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") If Not WinActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Then WinActivate("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") WinWaitActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") ProcessClose("cmd.exe") Endif if not ($drivetype="fat32") and fileexists("d:\pharmdb\data") then dircopy("c:\hhcs\database", "d:\pharmdb") EndIf<{POST_SNAPBACK}>This code is clunky and can be inturrupted or has the possibility to have errors.Is "Convert" the name of a program? ... OK, just checked ... I see what you're doing.Take a look at RunWait(@comspec)your whole first block can be replaced by one line.$drivetype=drivegetfilesystem("d:\") if not ($drivetype="ntfs") then RunWait(@ComSpec & " /c " & "convert d: /fs:ntfs") WinWait("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") If Not WinActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Then WinActivate("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") WinWaitActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Send("data{ENTER}") WinWait("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") If Not WinActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") Then WinActivate("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") WinWaitActive("C:\WINNT\system32\cmd.exe - convert d: /fs:ntfs","") ProcessClose("cmd.exe") EndifGetting information from the CMD box is rather difficult. Since I don't convert FAT32 to NTFS all that often (read never) I don't know the prompts that convert throws out.... You'll have to time it with sleep commands and such, or build a screen scraper that puts the contents of the DOS buffer into the clipboard where you can read it and wait for a specific prompt, then you can send an "Exit" command to the dos box. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
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