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: 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. Example:
Dim 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. Example:
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. Example:
' read menu |
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. Example:
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. Example:
Dim mat |
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. Example:
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") Example: 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.
If cache=True is specified, external files are first searched in the GuiXT cache. Example:
imgpath = guixt.FilePath("images\home.gif")
imgpath = guixt.FilePath("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 mit
Class va03_list_events
End Function |
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. Example:
ie.Navigate(url)
|
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. ...". Example:
Set imgList = guixt.CreateObject("ComCtl.ImageListCtrl")
|
GetObject() |
guixt.GetObject(progid) Almost identical to the VBScript function GetObject. Example:
Set excel = guixt.GetObject("Excel.Application") |
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. Example:
Dim all_vkorg
For Each row In all_vkorg |