Articles in this section

When parentheses should be used in in TestScript?

The custom server has some functions, namely the Recordable function and the helper function. Summarizing both and looking from the TestScript view, there are functions with return type and functions without return type. The function with return type can be compared to a Function Procedure, and the function without return type can be compared to a Sub Procedure. They are described generically as functions in the custom server.


All recordable functions are Sub Procedures as they do not have a return type, while most of the helper functions are Function Procedures. Call to Sub procedure does not require parentheses, but call to Function Procedure requires parentheses.

root = SwfWindow("SwfWindow").SwfObject("SwfObject").TraceParentRoot("Menu 13")

MsgBox root

SwfWindow("Form1").Move 659,249

SwfWindow("Form1").Click 22,187,MIC_RIGHT_BUTTON

SwfWindow("SwfWindow").SwfObject("SwfObject").Select "Parent Menu 3;Parent Menu 6;Menu 13"

'call SwfWindow("SwfWindow").SwfObject("SwfObject").Select ("Parent Menu 3;Parent Menu 6;Menu 13")

In the example script above, TraceParentRoot is a helper function with a return type, therefore used with parentheses. This can be treated like Function procedure.


Select is a recordable function and do not have a return type, therefore used without parentheses. This can be treated like Sub Procedure.

Note: On the last commented script call is optional, but when call is used, parentheses are must for the Sub procedures.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied