cancel
Showing results for 
Search instead for 
Did you mean: 

VBScript - Capture All Status Bar Text

Former Member
0 Kudos

I am tired of searching and finding no clear answers.

So here is the situation. I have a vbscript file that automates the SAP GUI. My issue is that I need to get the status text from the status bar after every input is made.

I have tried using findById("wnd[0]/sbar").text, but it does not capture every warning or error message.

Does the status bar object have any other properties besides text?

Any type of response would be greatly appreciated.

-Thanks

Accepted Solutions (0)

Answers (5)

Answers (5)

thomas_brutigam2
Active Participant
0 Kudos

Hi there -
the Statusbar has also some "Status" Tags like "Warning, Error, Information"

This can be captured by using this little script:

Set sStatusBar = sapsession.findById("wnd[0]/sbar")

If sStatusBar.Messagetype = "W" Or sStatusBar.Messagetype = "E" Then 'Warning or Error

' Do Something

end if

Set sStatusBar = Nothing

Secondly every Message shoul have an ID

This can be handled by sStatusbar.MessageID and returns Integer Value

Greetings

Thomas B

Former Member
0 Kudos

Hi, the object to look for is type GuistatusBar

here is a VB sample

Function getStatus() As String

        If IsNothing(sess) Then

            Return "session is not connected"

        Else

            Return Me.sess.ActiveWindow.FindByName("sbar", "GuiStatusbar").text

        End If

End Function

the demo examlpe in my script automation tool sends a /$TAB okcode to a sapgui and the retrieves the text in the statusbar

The tool is in SF is called lbscript

Regards

Btw, there is also a dumpscreen method which creates a text file with all the screen or window elements so you can retrieve them later on.

Here is the line which contains the statusbar message and type

"/app/con[0]/ses[0]/wnd[0]/sbar    Name: sbar    Type: GuiStatusbar    Value: TAB buffer reset    Read only    Children:7"

former_member709020
Participant
0 Kudos

BTW...

I created an error trap which resolved to show the SAP status bar text just fine.  You could just as well direct this a txt log file:

On Error GoTo errSAP

~~your code~~

errSAP:

errMessage = session.FindById("wnd[0]/sbar").Text

MsgBox errMessage

Former Member
0 Kudos

Yeah, please refer to the thread Andreas is mentioning. Here you will find some examples.

Good luck

Former Member
0 Kudos

Hi, you are looking for the same information that I am looking for - we should monitor each others threads :)(). Cheers, Andi