ctrx_execute_on_window_name_change
Example | General Functions |
Specifies handler function when a window's name changes.
void ctrx_execute_on_window_name_change( char *window_name, long handler );
window_name | The name of the window (before the name change) that initiates the handler. |
handler | The function to invoke when the window's name changes. |
ctrx_execute_on_window_name_change specifies the function to call when a window's name changes. When a window with the name window_name changes its name, the handler function is invoked.
The asterisk wildcard character (*) can be used in window_name.
Put the actions you wish to perform in the handler function, which must have the following prototype:
int handler( char *title);
The name of the window is passed to the handler as title argument.
Note:
- We recommend including a think time after the handler function is invoked, especially if it is invoked at the end of the Actions section of a Vuser script. If the handler function is invoked at the end of the Actions section and is not followed by a think time, the vuser_end logoff procedure may be executed before the handler function is completed.
- The lr_rendezvous function is not supported when a ctrx_execute_on_window_activation function is pending.
Return Values
This function has no return value.
Parameterization
No parameterization is available for this function.
Example
In this example, the script is waiting for the title of the Notepad window to change. When the change occurs, a generic message is written in the log noting the window's old name.
int callbackf_name_change(char *title)
{
lr_log_message("The following window was given a new name: %s", title);
return 0;
}
Action()
{
ctrx_execute_on_window_name_change("Untitled - Notepad" , callbackf_name_change);
…
}