How to call C Function in Ajax TrueClient?

Call C Function in Ajax TrueClient Script

C Function in ajax trueclient is used to write your own custom code in the C-function.c file. Then call the function in your script to execute the custom code.

We will see how to call the C function from the ajax trueclient script step by step.

Step 1 :

  • Launch the trueclient protocol in the Vugen.
  • And click on Develop script option in the script.
  • And record the flow or you can add the functions before itself.

Add Ajax TrueClient VTS functions : Script

Click Here to know how to record the script in trueclient

Step 2:

  • Drag and drop the Evaluate Java script into the trueclient panel from the miscellaneous section.
  • And click on the js option present in the Evaluate Java script option.
  • Once you click on the js option, the working area will be displayed.

Add Ajax TrueClient VTS functions : Java script

Step 3 :

  • Call the C function using the TC.evalC function.
  • Syntax : TC.evalC(Functionname,timeout);
    • Functionname : Name of the function which you will be calling from the C Function file.
    • timeout : You can specific how long you want the function to wait for completing it.
  • So the function looks like this TC.evalC("Demo",20);  after you entering the required field data.
  • And also  we will add the message so that we can see the message in the output panel once the function is successfully called.
  • After writing the function click on OK button.

Click Here to know more about the Ajax TrueClient functions.

Step 4 :

  • Now go to the C-function file and select the file.
  • Write your custom code in the C-Function file.
  • Save the script.
  • Close the Developer mode of the trueclient script.

Step 5 :

  • Once the developer mode is closed and the script view is enabled.
  • Save the script again and click on Run button.
  • So the script will be executed end to end without any error message.
  • Go to the output panel, you will see the message when the function is called and the custom code as well.
  • Below is the example how it will be displayed in the output panel.

 

Leave a Reply

Your email address will not be published. Required fields are marked *