on 06-03-2015 10:50 PM
Hi,
I am struggling to stop the scripting engine in VB.NET I tried multiple ways to make the following code but nothing worked for me. Always the baber pole shows running on all the open sessions.
Sapguiauto = GetObject("SAPGUI")
sapapplication = sapguiauto.getscriptingengine
For Each Connection In SapApplication.Children
If Not Connection.DisabledByServer Then
For Each session In Connection.Children
ComboBox1.Items.Add(session.Info.SystemName + " (" + CStr(session.Info.SessionNumber) + ") (" + session.Info.Client + ")")
ListBox1.Items.Add(session.Id)
Next
End If
Next
sapguiauto = Nothing
Connection = Nothing
sapapplication = nothing
session = Nothing
Even though all the variables to nothing, still the barber pole shows running. I found only the way to close the exe application to stop it. Is there any way to stop it and start when we start recording.
Thanks
Hello Sampath,
welcome to Scripting Language forum.
Here a solution to stop the rotating barber pole, it is a simple VB.NET console application:
'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Strict Off
Option Explicit
'-Imports-------------------------------------------------------------
Imports System
Imports System.Runtime.InteropServices
Imports System.Threading
'-Modules-------------------------------------------------------------
Module ModuleMain
Sub Main()
'-Variables-----------------------------------------------------
Dim SAPGUIAuto As Object
Dim SAPApplication As Object
Dim Connection As Object
Dim Session As Object
Dim OutText As String
SAPGUIAuto = GetObject("SAPGUI")
If IsReference(SAPGUIAuto) Then
SAPApplication = SAPGUIAuto.GetScriptingEngine()
If IsReference(SAPApplication) Then
For Each Connection In SAPApplication.Children()
For Each Session In Connection.Children()
OutText = Session.Info.SystemName()
OutText += " (" & CStr(Session.Info.SessionNumber()) & ")"
OutText += " [" & Session.Info.Client() & "]"
Console.WriteLine(OutText)
Next
Next
End If
End If
'-Barber pole rotates-------------------------------------------
Thread.Sleep(2048)
'-Releases COM object-------------------------------------------
Marshal.ReleaseComObject(SAPGUIAuto)
GC.Collect()
GC.WaitForPendingFinalizers()
'-Barber pole now rotates not any longer------------------------
Console.Write("Press enter to exit...")
Console.ReadLine()
End Sub
End Module
'-End-------------------------------------------------------------------
Let us know your result
Cheers
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Excellent got it. Thank you for you help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.