Macro Script File Structure

Top  Previous  Next

The Macro script file has a JavaScript function that allows the interaction with the emulation screen.

The script is structured in the three main sections:

 

1. Obtain the Display object:

 

The command getDisplay() will return an object display, the resource that will allow interaction with the emulation screen.

 

2. Define the macro steps:

 

In this section there should be a function for each step to be executed by the macro. A step generally ends with an AID key command sent to the host.

 

3. Set the order for the steps to be executed:

 

At last, it is necessary to set the sequence in which all the steps will be executed. The display.addNavigationPath command should be used to complete this section.

 

 

Macro script example

 

 

(function () {

 

  // Section 1- Obtains the object to interact with the emulation

  var display = getDisplay();

 

 

  // Section 2 - Macro execution steps

   step1 = function () {

       display.type("USERX");

       display.setField("R4C47","kljhfhvkjgiuihkljhhmkjfhldskfjdlkfasdldfjf0dfkajsdf=");

       display.cursorPos = 295;

       display.pressAndWait("ENTER");

   },

 

   step2 = function () {

       display.cursorPos = 561;

       display.pressAndWait("ENTER");

   },

 

   step3 = function () {

       display.waitForField("R20C7", 5000);

       display.type("wrksplf");

       display.cursorPos = 1534;

       display.pressAndWait("ENTER");

   },

 

   step4 = function () {

       display.type("4");

       display.setField("R11C3", "4");

       display.cursorPos = 883;

       display.pressAndWait("ENTER");

   },

 

   step5 = function () {

       display.cursorPos = 1;

       display.pressAndWait("ENTER");

   },

 

   step6 = function () {

       display.setField("R21C7", "go main");

       display.cursorPos = 1614;

       display.pressAndWait("ENTER");

   },

 

   step7 = function () {

       display.type("90");

       display.cursorPos = 1529;

       display.pressAndWait("ENTER");

   }

 

 

  // Section 3 - Order in which the macro steps will be executed

   display.addNavigationPath(this, null, null, step1);

   display.addNavigationPath(this, step1, null, step2);

   display.addNavigationPath(this, step2, null, step3);

   display.addNavigationPath(this, step3, null, step4);

   display.addNavigationPath(this, step4, null, step5);

   display.addNavigationPath(this, step5, null, step6);

   display.addNavigationPath(this, step6, null, step7);

 

})();

 

You can also see more examples, by creating macros from the z/Scope Anywhere interface and then opening the generated script files to see how they were written by the application (here you can find out where they are going to be placed by z/Scope Anywhere).

 

Related Topics

 

Creating Macros
Macro Methods and Properties