;-Begin-----------------------------------------------------------------
;-
;- Program to start the SAP application server
;-
;-----------------------------------------------------------------------

;-WindowTitle-----------------------------------------------------------
  Dim $WinTitle = "sapmmc - [Console Root\SAP Systems\NSP]"
  Dim $WinClass = "MMCMainFrame"
  Dim $Title = "[TITLE:" & $WinTitle & "; CLASS:" & $WinClass & "]"
      
;-Your password---------------------------------------------------------
  Dim $Password = "root"
      
;-Procedure to start SAP application server-----------------------------
  Func StartABAPServer()
  
    Dim $TreeView = "[CLASS:SysTreeView32; CLASSNN:SysTreeView321]"
    Dim $SAPMMC = Run("C:\\WINDOWS\\system32\\mmc.exe " & _
      "C:\\WINDOWS\\sapmmc.msc", "C:\\WINDOWS\\")
  
    If $SAPMMC Then
      ;-Wait for MMC window---------------------------------------------
        WinWaitActive($Title)
      ;-Select the NSP node---------------------------------------------
        ControlTreeView($Title, "", $TreeView, "Select", "NSP")
      ;-Start the application server------------------------------------
        Send("!t{ENTER}{ENTER}")
        WinWaitActive("[TITLE:WebService Authentication; " & _
          "CLASS:#32770]")
      ;-Insert the password---------------------------------------------
        ControlSetText("[TITLE:WebService Authentication; " & _
          "CLASS:#32770]", "", "[CLASS:Edit; CLASSNN:Edit2]", _
          $Password)
        Send("{ENTER}")
    EndIf

  EndFunc
    
;-Main------------------------------------------------------------------
  StartABAPServer()      

;-End-------------------------------------------------------------------