Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Profil CosminaCSM
Femeie
23 ani
Bucuresti
cauta Barbat
23 - 39 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [VBS] Check if SAP is Open or Not Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
If using a Sub inside a HTA file, use the following snippet:

' ################################# VERIFICA DACA E SAP DESCHIS <---- START ----> cod CU Sub

If Not IsObject(application) Then
        On Error Resume Next
   Set SapGuiAuto  = GetObject("SAPGUI")
       If SapGuiAuto is Nothing Then
            MsgBox "Deschide mai intai SAP"
            Exit Sub 'Wscript.Quit
       End If
           On Error Resume Next
   Set application = SapGuiAuto.GetScriptingEngine
       If application is Nothing Then
            MsgBox "Deschide mai intai SAP"
            Exit Sub 'Wscript.Quit
       End If 
End If

If Not IsObject(connection) Then
           On Error Resume Next
   Set connection = application.Children(0)
       If connection is Nothing Then
            MsgBox "Deschide mai intai SAP"
            Exit Sub 'Wscript.Quit
       End If     
End If

If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If

If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If

' ################################# VERIFICA DACA E SAP DESCHIS <---- SFARSIT ----> Cod CU Sub


If using a VBS file without a HTA part (no Sub), use the following snippet:

' ################################# VERIFICA DACA E SAP DESCHIS <---- START ----> Cod FARA Sub

If Not IsObject(application) Then
        On Error Resume Next
   Set SapGuiAuto  = GetObject("SAPGUI")
       If SapGuiAuto is Nothing Then
            MsgBox "Deschide mai intai SAP"
            Wscript.Quit
       End If
           On Error Resume Next
   Set application = SapGuiAuto.GetScriptingEngine
       If application is Nothing Then
            MsgBox "Deschide mai intai SAP"
            Wscript.Quit
       End If 
End If

If Not IsObject(connection) Then
           On Error Resume Next
   Set connection = application.Children(0)
       If connection is Nothing Then
            MsgBox "Deschide mai intai SAP"
            Wscript.Quit
       End If     
End If

If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If

If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If

' ################################# VERIFICA DACA E SAP DESCHIS <---- SFARSIT ----> Cod FARA Sub


_______________________________________


pus acum 2 ani
   
Pagini: 1  

Mergi la