Object Access with Silk Performer

To make object access easier, Silk Performer API calls do not require full object IDs for controls. Instead, the relative object ID of the current window can be used for most API calls.

For example, pressing the button /app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[0] can be done with SapGuiPressButton ("tbar[0]/btn[0]");.

To do this, Silk Performer requires the information about the current window, session, and connection. For this purpose there are three methods that allow you to set the current context:
  • SapGuiSetActiveConnection
  • SapGuiSetActiveSession
  • SapGuiSetActiveWindow

When you record a script you see one of the three above mentioned functions scripted wherever the context has changed.

A typical script looks like this:
gsConnID := SapGuiOpenConnection("CONNECTSTRING");
SapGuiSetActiveConnection(gsConnID);
SapGuiSetActiveSession("ses[0]");
SapGuiSetActiveWindow("wnd[0]");
SapGuiPressButton("/tbar[0]/btn[0]");

This makes scripts easier to read and customize.