Purpose When you enter a VBScript function with  CallVBS, a global object "guixt" is already defined. It allows easy access to GuiXT script variables and provides several useful functions, for example RFC calls.

The same object is passed to an HTML page by  connectHTML: the JavaScript or VBScript function guixt_initialize(obj) is called up (if found in the HTML page), passing the guixt object:

<script type=text/javascript>

  var guixt;

  function guixt_initialize(obj)
    guixt = obj;

   // ...


If the HTML page was displayed with  WebView, you can use the object "guixthost" directly and do without the function guixt_initialize(). A call to connectHTML is nevertheless necessary.

Component "GuiXT Controls" is needed for this feature.

Get() r = guixt.Get(var)

If the content of var is "xxx", the GuiXT script variable V[xxx] is read and its content is stored into r.


Dim menu_icon_path
menu_icon_path = guixt.Get("menu_icon_path") 

Set() guixt.Set(var,value)

If the content of var is "xxx", the GuiXT script variable V[xxx] is set to the content of value.


guixt.Set("menu_icon_path", "C:\guixt\menu\icons") 

GetText() r = guixt.GetText(var)

If the content of var is "xxx", the  GuiXT long text variable text[xxx] is read and its content is stored into r.


' read menu
Dim menu
menu = Split(guixt.GetText("menu"), vbCrLf)

SetText() guixt.SetText(var,value)

If the content of var is "xxx", the GuiXT long text variable text[xxx] is set to the content of value.


Call guixt.settext("menu_layout",Join(s,vbCrLf))

Value() r = guixt.Value(var)

GuiXT replaces all &-expressions in the given string, applying the usual GuiXT logic, and stores the result into r.


Dim mat
mat = guixt.Value("&F[Material]") 


Input() guixt.Input(s)

The given string is interpreted as input to SAP GUI entry fields, together with a function code and optionally an InputScript, as described in the input= option of the  Image command.


guixt.input("U[VBELN]:" & ListView.selectedItem)


Process() guixt.Process(funcname, par1, par2, ...))

Corresponds to the GuiXT instruction Process.

From the first parameter funcname the script name "process_[funcname].txt" is formed. This script is executed, whereby the parameters of the script are occupied by the values of par1, par2,... . The string set at "Return" in the script is returned.

address = guixt.process("customeraddress", "K1032")


var guixt;
function guixt_initialize(obj) {
     guixt = obj;

function display_address() {

     // current customer number from screen
     var mykunnr = guixt.value("&F[Customer]")

     // read address
     var jsonaddr = guixt.process('customer/readaddress', mykunnr)

     // parse address data into JavaScript object
     var addr = JSON.parse(jsonaddr);

     // display address
     document.getElementById('name1').innerText = addr.name1; 
     document.getElementById('name2').innerText = addr.name2;
     document.getElementById('stras').innerText = addr.stras;
     document.getElementById('pstlz').innerText = addr.pstlz;
     document.getElementById('ort01').innerText = addr.ort01;
     document.getElementById('landx').innerText = addr.landx;

FilePath() guixt.FilePath(s, [cache=True])

The given string is interpreted as file name within the current GuiXT script folder.

  • The full file path, together with the script directory, is returned.
  • An absolute file path such as "C:\guixt\scripts\..." is not changed.
  • For files in SAP Web Repository "SAPWR:..." the file is copied into the GuiXT cache folder and the local file name in the cache is returned
  • For http or ftp files "http://..."  or "ftp://..." the file is copied into the GuiXT cache folder and the local file name in the cache is returned

If cache=True is specified, external files are first searched in the GuiXT cache.


imgpath = guixt.FilePath("images\home.gif")
imgpath is now e.g. "C:\guixt\scripts1\images\home.gif"

imgpath = guixt.FilePath("http://www.synactive.com/images/s10logo_blue.gif")
imgpath is now e.g. "C:\Users\ADMINI~1\AppData\Local\Temp\guixt\GuiXT Cache\http\www.synactive.com\images\s10logo_blue.gif"

SetEventHandler() guixt.SetEventHandler(obj1,obj2)

You specify two objects. For each event, e.g. "Click", of obj1 the corresponding function "On...", e.g. "OnClick", of obj2 is called. The event parameters are passed to the function according to the event's interface specification; you have to define a matching number of function parameters.

In most cases obj1 will be a given control , e.g. a List View, and obj2 will be an object of a VBScript class that you have specifically defined for event handling.

Tip 1: The GuiXT trace function can display all raised events with their actual parameters as soon as a (maybe still empty) event handler object is set.

Tip 2: All possible events and their parameters can be viewed in VBScript editors such as "VbsEdit".

Example (see tutorial 4 of  GuiXT Controls for details):

' handle  events
Set e = New va03_list_events
Set e.ListView = lv
Call guixt.SetEventHandler(lv, e)


Class va03_list_events
    Dim ListView
    Function OnColumnClick(ColumnHeader)


DoEvents() guixt.DoEvents()

The function waits a few milliseconds and then processes all Windows messages from the message queue.

You need this function for controls that work with asynchronous processing. For example, the Internet Explorer control loads html pages asynchonously, and before you can access a new page you have to interrupt your own program with DoEvents() until the page has been loaded.



' wait until document is loaded
LoopWhile ie.ReadyState = READYSTATE_LOADING

CreateObject() guixt.CreateObject(progid)

Almost identical to the VBScript function CreateObject(). The difference is that the GuiXT Controls function CreateObject() uses a statically predefined version of the Windows Common Controls "Comctl. ...".


Set imgList = guixt.CreateObject("ComCtl.ImageListCtrl")

GetObject() guixt.GetObject(progid)

Almost identical to the VBScript function GetObject.


    Set excel =  guixt.GetObject("Excel.Application")
    If excel isnothingthen
        MsgBox ("Excel not running")
        excel.visible = True
        excel.Cells(1, 1).Value = "Hello"

Rfc() guixt.Rfc(arguments,...)

Calls an SAP function module (remote functiion call). The parameters are as described for the Call command. You do not specify the whole Call command as a single string, but each part as a separate parameter.

After processing the call the GuiXT variable V[_exception] is set to "", if no error has occured, and contains an error text or the name of an exception otherwise. You can read the variable with  guixt.Get("_exception") .

Table parameters are represented as VBScript arrays of strings, i.e. each table row is a string element of the array. If you need the table exclusively as output of the function module, you can simply define it with "Dim" and the Rfc() function will create the output array in the right size.


Dim all_vkorg

' read data via RFC / SAP searchhelp
Call guixt.Rfc("Z_S10_SEARCHHELP", "in.SEARCHHELP", "H_TVKO",  "in.COLUMNS",  
,  "table.DATA(WIDTH:24)", all_vkorg)

ForEach row In  all_vkorg
   Dim vtext
   vkey  = Mid(row,1,4)
   vtext = Mid(row,5,20)