Using FunctionsIn computer programming, a function is predefined code which performs a specific action. Most programming languages such as VB™ come with a pre-written, built-in range of functions that perform various procedures or routines. WinTask x64 includes many functions that can be used at any line in an automation script.
The general format of a function is its name followed by any parameters contained in between parenthesis:
A parameter (sometimes referred to as argument) is a value sent to the function when it is called upon. By passing a parameter to a function, the function is given information to work on.
Certain functions may not need parameters to properly perform its duty. For example, the WeekDay() function returns the weekday for today's date and does not need any parameter. Therefore the proper syntax for this kind of functions is simply the function himself, with nothing entered in between the parenthesis. If the result of the function is numeric, the function name must not end with the $ character. If the result of the function is a string (string of characters), the function name must end with the $ character. For example:
returns the current date value as a string of characters, such as 08/12/2013.
returns the weekday as an integer, such as 3
Most of the functions require parameters, for example the Len() function returning the number of characters in a string. The syntax for this function is Len("string") which requires some characters surrounded by " to be entered inside the parenthesis in which it will perform calculations on. For example:
returns 5, the length of the word Hello.
Another example with a function returning a string of characters, the Trim$ function:
Trim$(" Hello ")
returns Hello without any leading and trailing spaces
An example of a function requiring more elaborate parameters is the InStr() function, which returns the position of a string in another string. The syntax for this function is InStr("string1","String2"). For example:
returns 4, the letter T is the 4th character in the word WinTask x64.
Another example with a function returning a string, the Left$() function which returns a specified number of characters from the left side of a string. The syntax for this function is Left$("string", length) which requires a valid string followed by the amount of characters to return inside the parenthesis. For example:
Left$("WinTask x64", 3)
returns the string Win.
To know the syntax of a WinTask x64 function, search for its help article in Language Reference section of this help.
Or in WinTask x64 Editor window, type the function name, move the cursor below one of the letters of the function name and press F1. It opens the help for this function.