<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Using VBScript for Automated Login to SAP in Additional Q&amp;A</title>
    <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171191#M141259</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton, works perfectly.&amp;nbsp; If you ever are in Greenville, SC (USA) let me know and I will buy you a beer.&amp;nbsp; I added some variables to be declared at the beginning due to the Option Explicit added my script to the end and it went off without a hitch.&amp;nbsp; End results are available at: &lt;A href="https://github.com/PaulStreet/sapscripts/blob/master/SAPLogin.vbs" title="https://github.com/PaulStreet/sapscripts/blob/master/SAPLogin.vbs"&gt;https://github.com/PaulStreet/sapscripts/blob/master/SAPLogin.vbs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I have placed the script below for preview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REM The following script was written to log into the SAP server automatically.&lt;/P&gt;&lt;P&gt;REM To view historical information and credit for this script please see&lt;/P&gt;&lt;P&gt;REM the following thread on the SAP Community Network:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;REM &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2269" data-containertype="14" data-objectid="3763970" data-objecttype="1" href="http://scn.sap.com/thread/3763970"&gt;http://scn.sap.com/thread/3763970&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REM This script was last updated by Paul Street on 7/1/15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REM Directives&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Option Explicit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; REM Variables!&amp;nbsp; Must declare before using because of Option Explicit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim WSHShell, SAPGUIPath, SID, InstanceNo, WinTitle, SapGuiAuto, application, connection, session&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; REM Main&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set WSHShell = WScript.CreateObject("WScript.Shell")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If IsObject(WSHShell) Then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the path to the SAP GUI directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAPGUIPath = "C:\Program Files\SAP\FrontEnd\SAPgui\"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the SAP system ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SID = "NBP"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the instance number of the SAP system&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo = "00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Starts the SAP GUI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSHShell.Exec SAPGUIPath &amp;amp; "SAPgui.exe " &amp;amp; SID &amp;amp; " " &amp;amp; _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the title of the SAP GUI window here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WinTitle = "SAP"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While Not WSHShell.AppActivate(WinTitle)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Sleep 250&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wend&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set WSHShell = Nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; REM Remove this if you need to test the above script and want a message box at the end launching the login screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM MsgBox "Here now your script..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If Not IsObject(application) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set SapGuiAuto&amp;nbsp; = GetObject("SAPGUI")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set application = SapGuiAuto.GetScriptingEngine&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If Not IsObject(connection) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set connection = application.Children(0)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If Not IsObject(session) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set session&amp;nbsp;&amp;nbsp;&amp;nbsp; = connection.Children(0)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If IsObject(WScript) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject session,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "on"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject application, "on"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]").maximize&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "USERNAME"&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "PASSWORD"&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 10&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2015 19:50:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2015-07-01T19:50:59Z</dc:date>
    <item>
      <title>Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaq-p/11171189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm attempting to create a VBScript that will login to my companies SAP and basically run a report that outputs an HTM file for use with some other reports.&amp;nbsp; Generating the actual report goes off without a hitch, but I would like to set up a chron job (recurring windows task) that would completely automate this process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am primarily running into a problem with the automated login to SAP.&amp;nbsp; I have code that can open the SAP executable and I have code that can input the username and password into the login screen but I am at a loss on how to select and execute the target server (it is auto selected at the beginning but sending WshShell.SendKeys "{ENTER}" does not seem to work).&amp;nbsp; Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code can reviewed on github with comments:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/PaulStreet/warroom/blob/master/SAPLogin.vbs" title="https://github.com/PaulStreet/warroom/blob/master/SAPLogin.vbs"&gt;warroom/SAPLogin.vbs at master · PaulStreet/warroom · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For convenience I have also pasted the code (VBScript below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'The below section will create an SAP session.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;set WshShell = CreateObject("WScript.Shell")&lt;/P&gt;&lt;P&gt; Set proc = WshShell.Exec("C:\Program Files\SAP\FrontEnd\SAPgui\saplogon.exe")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do While proc.Status = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Sleep 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set SapGui = GetObject("SAPGUI")&lt;/P&gt;&lt;P&gt;Set Appl = SapGui.GetScriptingEngine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;''Deprecated alternate code, wait for 6 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Dim dteWait&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'dteWait = DateAdd("s", 6, Now())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Do Until (Now() &amp;gt; dteWait)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Loop&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Wait for 5 seconds then press enter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;WScript.Sleep 5000&lt;/P&gt;&lt;P&gt;WshShell.SendKeys "{ENTER}"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;''This commented section of code doesn't seem to work for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Set Connection = Appl.Openconnection("Test SAP", True)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Set session = Connection.Children(0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USERNAME"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "PASSWORD"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "E"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'session.findById("wnd[0]").sendVKey 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'The below code is what I can record once I have gotten to the SAP login for the target server.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If Not IsObject(application) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set SapGuiAuto&amp;nbsp; = GetObject("SAPGUI")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set application = SapGuiAuto.GetScriptingEngine&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If Not IsObject(connection) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set connection = application.Children(0)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If Not IsObject(session) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set session&amp;nbsp;&amp;nbsp;&amp;nbsp; = connection.Children(0)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If IsObject(WScript) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject session,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "on"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject application, "on"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]").maximize&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "USERNAME"&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "PASSWORD"&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 10&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a screenshot of the screen I cannot get past (SAP executable with server select); ie the &lt;SPAN style="font-size: 10pt;"&gt;screen I cannot get past (there are other servers that I have censored out).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/736537" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 14:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaq-p/11171189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-06-30T14:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171190#M141258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;welcome in the scripting forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use this VBScript to open a connection to an SAP system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;'-Begin-----------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; '-Directives----------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Option Explicit&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; '-Variables-----------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim WSHShell, SAPGUIPath, SID, InstanceNo, WinTitle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; '-Main----------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set WSHShell = WScript.CreateObject("WScript.Shell")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If IsObject(WSHShell) Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-Set the path to the SAP GUI directory---------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAPGUIPath = "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-Set the SAP system ID-------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SID = "NSP"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-Set the instance number of the SAP system-----------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo = "00"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-Starts the SAP GUI----------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSHShell.Exec SAPGUIPath &amp;amp; "sapgui.exe " &amp;amp; SID &amp;amp; " " &amp;amp; _&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-Set the title of the SAP GUI window here------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WinTitle = "SAP"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While Not WSHShell.AppActivate(WinTitle)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Sleep 250&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wend&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set WSHShell = Nothing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Here now your script..."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;'-End-------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it is not necessary to work with the SAP Logon or SAP Logon Pad directly. But if it is required you find on my &lt;A href="http://blog.stschnell.de/"&gt;blog&lt;/A&gt; an older solution from 19.02.2009 with &lt;A href="http://www.autoitscript.com/"&gt;AutoIt&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know your results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 06:14:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171190#M141258</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2015-07-01T06:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171191#M141259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton, works perfectly.&amp;nbsp; If you ever are in Greenville, SC (USA) let me know and I will buy you a beer.&amp;nbsp; I added some variables to be declared at the beginning due to the Option Explicit added my script to the end and it went off without a hitch.&amp;nbsp; End results are available at: &lt;A href="https://github.com/PaulStreet/sapscripts/blob/master/SAPLogin.vbs" title="https://github.com/PaulStreet/sapscripts/blob/master/SAPLogin.vbs"&gt;https://github.com/PaulStreet/sapscripts/blob/master/SAPLogin.vbs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I have placed the script below for preview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REM The following script was written to log into the SAP server automatically.&lt;/P&gt;&lt;P&gt;REM To view historical information and credit for this script please see&lt;/P&gt;&lt;P&gt;REM the following thread on the SAP Community Network:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;REM &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2269" data-containertype="14" data-objectid="3763970" data-objecttype="1" href="http://scn.sap.com/thread/3763970"&gt;http://scn.sap.com/thread/3763970&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REM This script was last updated by Paul Street on 7/1/15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REM Directives&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Option Explicit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; REM Variables!&amp;nbsp; Must declare before using because of Option Explicit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim WSHShell, SAPGUIPath, SID, InstanceNo, WinTitle, SapGuiAuto, application, connection, session&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; REM Main&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set WSHShell = WScript.CreateObject("WScript.Shell")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If IsObject(WSHShell) Then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the path to the SAP GUI directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAPGUIPath = "C:\Program Files\SAP\FrontEnd\SAPgui\"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the SAP system ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SID = "NBP"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the instance number of the SAP system&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo = "00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Starts the SAP GUI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSHShell.Exec SAPGUIPath &amp;amp; "SAPgui.exe " &amp;amp; SID &amp;amp; " " &amp;amp; _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM Set the title of the SAP GUI window here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WinTitle = "SAP"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While Not WSHShell.AppActivate(WinTitle)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Sleep 250&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wend&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set WSHShell = Nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; REM Remove this if you need to test the above script and want a message box at the end launching the login screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REM MsgBox "Here now your script..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If Not IsObject(application) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set SapGuiAuto&amp;nbsp; = GetObject("SAPGUI")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set application = SapGuiAuto.GetScriptingEngine&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If Not IsObject(connection) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set connection = application.Children(0)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If Not IsObject(session) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set session&amp;nbsp;&amp;nbsp;&amp;nbsp; = connection.Children(0)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If IsObject(WScript) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject session,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "on"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject application, "on"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]").maximize&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "USERNAME"&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "PASSWORD"&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 10&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 19:50:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171191#M141259</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-01T19:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171192#M141260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply, your source and your beer invitation. &lt;SPAN __jive_emoticon_name="grin" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_macro jive_emote" src="https://community.sap.com/1291/images/emoticons/grin.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Perhaps in the Blue Ridge or Connolly's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 16:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171192#M141260</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2015-07-04T16:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171193#M141261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for this script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using it with my own variables for SAPGUIPath, SID and InstanceNo. I get this error while connecting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;MessageBox 6E74E3&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;hostname 'B0Y' unknown&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check your application server name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you want to see the detailed error description?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;OK&amp;nbsp;&amp;nbsp; Cancel&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;SAP GUI for Windows 730&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;hostname 'B0Y' unknown&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sat Jul 25 16:17:08 2015&lt;/P&gt;&lt;P&gt;Component&amp;nbsp;&amp;nbsp;&amp;nbsp; NI (network interface)&lt;/P&gt;&lt;P&gt;Release&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 730&lt;/P&gt;&lt;P&gt;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40&lt;/P&gt;&lt;P&gt;Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ninti.c&lt;/P&gt;&lt;P&gt;Line&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 897&lt;/P&gt;&lt;P&gt;Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NiPGetHostByName: 'B0Y' not found&lt;/P&gt;&lt;P&gt;Return Code&amp;nbsp;&amp;nbsp;&amp;nbsp; -2&lt;/P&gt;&lt;P&gt;System Call&amp;nbsp;&amp;nbsp;&amp;nbsp; getaddrinfo&lt;/P&gt;&lt;P&gt;Counter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;OK&amp;nbsp; &lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea how to resolve this error?&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Sebastjan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Jul 2015 14:20:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171193#M141261</guid>
      <dc:creator>former_member227666</dc:creator>
      <dc:date>2015-07-25T14:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171194#M141262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sebastjan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;welcome in Scripting Language forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try instead of the SID, in your case B0Y, the IP address of the target SAP system like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;'-Set the SAP system ID-------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; SID = "10.100.202.145"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;'-Set the instance number of the SAP system-----------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; InstanceNo = "63"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;'-Starts the SAP GUI----------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp; WSHShell.Exec SAPGUIPath &amp;amp; "sapgui.exe " &amp;amp; SID &amp;amp; " " &amp;amp; _&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceNo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case it works also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know your results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2015 07:36:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171194#M141262</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2015-07-27T07:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171195#M141263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you for the fast reply.&lt;/P&gt;&lt;P&gt;Unfortunatelly I get the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't specified my connection parameters in my post above. I connect via Astaro VPN and use message server and SAP router to connect to the system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Sebastjan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2015 08:27:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171195#M141263</guid>
      <dc:creator>former_member227666</dc:creator>
      <dc:date>2015-07-27T08:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171196#M141264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I managed to get this to work by providing the SID as:&lt;/P&gt;&lt;P&gt;&amp;lt;router&amp;gt;&amp;lt;message server&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also found a lot information in the &lt;A href="https://service.sap.com/sap/support/notes/103019"&gt;SAPNote 103019&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sebastjan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171196#M141264</guid>
      <dc:creator>former_member227666</dc:creator>
      <dc:date>2015-07-30T09:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171197#M141265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sebastjan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you very much for this interesting Information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:27:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171197#M141265</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2015-07-30T09:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171198#M141266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have question about this. Whenever i log on to the system for the first time, it works fine but when i try to log on to the second system while still connected to the first one, the procedure stops at the login screen. For instance i first log in to BPD then to BAP and want to be and stay connected to both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would i have to modify to the code for this to work via this script? Thanks Lucien &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 13:08:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171198#M141266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-25T13:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171199#M141267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Lucien,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;welcome in the Scripting Languages forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems a problem of the code line WSHShell.AppActivate(WinTitle) - which is not very reliable.&lt;/P&gt;&lt;P&gt;Is it possible for you to use PowerShell, like I describe &lt;A _jive_internal="true" href="https://answers.sap.com/community/scripting-languages/blog/2015/09/26/how-to-use-powershell-for-automated-login-to-sap"&gt;here&lt;/A&gt;, or other libraries which offers these function, like AutoItX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Sep 2015 05:43:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171199#M141267</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2015-09-26T05:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171200#M141268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a similar issue. And I thought it's the same as Lucien has described but now I'm not so sure. Whenever I run a macro to do some stuff in a system I have to implement the system logoff as well in order to something in another system. If I already have a system open, then my macro for the next automated procedure just opens the next system and logs on. After that the procedure stops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've diagnosed this as the connection issue by using the sap scripting tracker tool (&lt;A __default_attr="59538" __jive_macro_name="document" class="jive_macro_document jive_macro" data-orig-content="Scripting Tracker - Development Tool for SAP GUI Scripting" href="https://community.sap.com/"&gt;&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first open system has the ID of &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/app/con[0]/ses[0]/wnd[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the second one has the Id of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/app/con[1]/ses[0]/wnd[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the con element incremented by one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my code I'm only calling the IDs by for example "session.findById("wnd[0]/usr/txtRSYST-MANDT")" leaving out the /app/con[0]/ part. Hence The script doesn't know which one to activate and perform the actions. Am I right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can this be bypassed by either explicitly calling also the connection element or by implementing some sort of connection count array to track all opened connections?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Sebastjan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Sep 2015 08:31:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171200#M141268</guid>
      <dc:creator>former_member227666</dc:creator>
      <dc:date>2015-09-26T08:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171201#M141269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sebastjan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yeah, you are right &lt;SPAN __jive_emoticon_name="cool" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_macro jive_emote" src="https://community.sap.com/1336/images/emoticons/cool.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find a function to get the connection number of the next logon screen of a given SID &lt;A _jive_internal="true" href="https://answers.sap.com/community/scripting-languages/blog/2015/09/26/how-to-find-the-next-logon-screen-of-a-sid-with-sap-gui-scripting"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your analysis, I was on the wrong track.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Sep 2015 16:43:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171201#M141269</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2015-09-26T16:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171202#M141270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, this was also my idea since the first log on to any SAP system worked and it was just the second time where the script failed. It seems logical that it has to do with some connection numbering/order. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally the script would always check for any active connection and simply choose the next one. Any help on this would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will further investigate as well, Cheers guys! Lucien &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2015 07:18:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171202#M141270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-28T07:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171203#M141271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What did I not define using the coding above as reference? I get an error that says 'Object variable or With block variable not set on this line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim WSHShell As Object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim SID As String&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim InstanceNo As String&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim WinTitle As String&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim SapGuiPath As String&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim WScript As Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Set WSHShell = WScript.CreateObject("WScript.Shell")&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 21:44:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171203#M141271</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-03-03T21:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using VBScript for Automated Login to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171204#M141272</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;st.schnell&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;'-Begin-----------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Directives----------------------------------------------------------&lt;/P&gt;&lt;P&gt;Option Explicit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Variables-----------------------------------------------------------&lt;/P&gt;&lt;P&gt;Dim WSHShell, SAPGUIPath, SID, InstanceNo, WinTitle&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Main----------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Set WSHShell = WScript.CreateObject("WScript.Shell")&lt;/P&gt;&lt;P&gt;If IsObject(WSHShell) Then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Set the path to the SAP GUI directory---------------------------&lt;/P&gt;&lt;P&gt;SAPGUIPath = "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Set the SAP system ID-------------------------------------------&lt;/P&gt;&lt;P&gt;SID = "NSP"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Set the instance number of the SAP system-----------------------&lt;/P&gt;&lt;P&gt;InstanceNo = "00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Starts the SAP GUI----------------------------------------------&lt;/P&gt;&lt;P&gt;WSHShell.Exec SAPGUIPath &amp;amp; "sapgui.exe " &amp;amp; SID &amp;amp; " " &amp;amp; _&lt;/P&gt;&lt;P&gt;InstanceNo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-Set the title of the SAP GUI window here------------------------&lt;/P&gt;&lt;P&gt;WinTitle = "SAP"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While Not WSHShell.AppActivate(WinTitle)&lt;/P&gt;&lt;P&gt;WScript.Sleep 250&lt;/P&gt;&lt;P&gt;Wend&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set WSHShell = Nothing&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MsgBox "Here now your script..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-End-----------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please continue this script until the logging in using a username and a password?&lt;/P&gt;&lt;P&gt;Since I already have an opened session I will really appreciate it if maybe you can add where the script will loop or cycle through active connections or sessions so that it will be able to log in successfully in the second SID.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Randolp&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 12:07:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/using-vbscript-for-automated-login-to-sap/qaa-p/11171204#M141272</guid>
      <dc:creator>former_member1246590</dc:creator>
      <dc:date>2023-01-07T12:07:08Z</dc:date>
    </item>
  </channel>
</rss>

