Wait for a key in a Dos box
The wait for a key in a Dos box needs a trick in order to work.
An example is given below - the window names used in this example are for Vista, change them if you use XP.Shell("Notepad.exe")
'Use Shell to launch the CMD Dos box.
Shell("cmd",1)
UseWindow("CMD.EXE|ConsoleWindowClass|D:\Windows\System32\cmd.exe")
'Here all the sendkeys you want in the Dos box
sendkeys("<enter>")
pause 5 ticks
sendkeys("Dir <enter>")
'Wait for F12 ; a wait for a key in a Dos box works only if
' the Dos box has not the focus
'So, as a trick, we generate a new UseWindow on a Window present on the desktop
'The Dos box has not the focus but the user still sees it
UseWindow("EXPLORER.EXE|SysListView32|FolderView")
Pause untilKey("<F12>")
PauseFalse
MsgBox("'Wait for' at line " + #ErrorLine$ + " has failed !",16,"Runtime error")
End
EndPause
'switch to Notepad
UseWindow("NOTEPAD.EXE|Edit|Untitled - NotePad|1",1)
sendkeys("hello")