Author Topic: "applyguiscript" Command  (Read 3956 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
"applyguiscript" Command
« on: June 06, 2017, 11:55:02 AM »
Purpose:
The applyguiscript command passes variables from a WS script to a Visual Basic (VB) script.
The applpyguiscript command is useful primarily when a user is dealing with special controls such as grids or ActiveX controls.

This command takes only one option which is {"template":true}
This option enables users to execute a pre-made template with the particular variables from the individual screen.
The template option used with applyguiscript enables a user to create a VBS file which is then called with the applyguiscript command.
When applyguiscript is invoked, the template is copied into a temporary file and all variables in the template are replaced with the actual values from the screen in question.
The VBS file then executes using these variables. This is very useful when a number of different values must be operated on in a similar manner.

Syntax:
applyguiscript('filename.vbs');
applyguiscript('C:\\LiquidUI\\Scripts\\filename.vbs');
applyguiscript("filename", {"template":true});

Liquid UI Code:
When user clicks the "IH06 - Select Grid Rows" button on the SAP Easy Access Screen, in this scenario, it navigates us to IH06 transaction and executes and selects the first 7 rows on the GRID screen using VB scripting (applyguiscript).

Sample script for the scenario-
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// Clears the screen UI
clearscreen();
pushbutton([2,2],"IH06 - Select Grid Rows", "/nIH06", {"process":ih06_selectrows, "size":[2,24]});

// Function to execute applyguiscript which selects the first 7 rows of a GRID
function ih06_selectrows(){
   onscreen 'RIIFLO20.1000'
      enter('/8');

   onscreen 'SAPLSLVC_FULLSCREEN.0500'
      applyguiscript("Script1.vbs");
}

NOTE - If the recorded VB script navigates through multiple screens, the related "onscreen" blocks must be added after "applyguiscript" command in the Liquid UI scripts.
Also, place the recorded VBScript file in the same path where the Liquid UI scripts are located for this scenario.

See attachments for code samples!
« Last Edit: June 28, 2017, 02:05:45 PM by Benjamin Dasari »