switchmodetool.vbs

option Explicit

' to invoke this script without a window: wscript /b switchmodetool.vbs
const runcmd="C:\path\to\Magic-Pro.SwitchDMBMode.exe"

dim WshShell, args_no
args_no = Wscript.Arguments.Count
set WshShell = CreateObject("WScript.Shell")
if WshShell.Run("""" & runcmd & """", 0, False) = 0 then
  Call ShowWindow
  if args_no = 0 then
    ' DMB-TH mode
    WshShell.Sendkeys "{Tab}{Tab}{ENTER}{Tab}{ENTER}"
  else
    ' DVBT-T mode
    WshShell.Sendkeys "{Tab}{ENTER}{Tab}{Tab}{ENTER}"
  end if
end if

sub ShowWindow()
  do while not WshShell.AppActivate("Switch Mode Tool")
    Wscript.sleep 100
  loop
end sub

Wscript.Quit

' http://www.computerperformance.co.uk/ezine/ezine120.htm
'BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
'BREAK {BREAK}
'CAPS LOCK {CAPSLOCK}
'DEL or DELETE {DELETE} or {DEL}
'DOWN ARROW {DOWN}
'END {END}
'ENTER {ENTER} or ~
'ESC {ESC}
'HELP {HELP}
'HOME {HOME}
'INS or INSERT {INSERT} or {INS}
'LEFT ARROW {LEFT}
'NUM LOCK {NUMLOCK}
'PAGE DOWN {PGDN}
'PAGE UP {PGUP}
'PRINT SCREEN {PRTSC}
'RIGHT ARROW {RIGHT}
'SCROLL LOCK {SCROLLLOCK}
'TAB {TAB}
'UP ARROW {UP}
'F1 {F1}

Comments