This sample demonstrates the use of the IsPending() method to process subject responses and execute InLine script while an object is still running.
The IsPending() method of a response object will return TRUE as long as all of the object’s input masks are pending. That is, as long as a) the time limit for a response has not expired, b) the maximum number of expected responses have not been received, and c) the termination response has not been received, IsPending() will return TRUE. Thus, a Do…While loop can be used to run script until the input masks are no longer pending.
For this to work, the response object’s Duration property must be set to 0 so that the script will begin executing immediately after the object appears on screen. To set the length of time that the object will remain on screen, you can specify a value in each input mask’s Time Limit property (i.e. 1000, 2000, infinite). Each input mask must also have their End Action property set to “(none)”.
To allow for more than one response and/or specify a termination response, select an input mask on the Duration/Input tab of the response object. Click the “Advanced” button to modify the Max Count and Termination Response properties.
If you are planning to copy the script from this sample into another experiment, you will also need to copy the script from the User tab of the Script window and paste it into the same place in your experiment. If you open the sample in E-Studio, go to 'View', and click on 'Script', your Script window will open.
For more information about User Script, please see this article: INFO: Declaring a global variable in User Script (Video How-To).