Difference between revisions of "ISKernel:WaitFor (Command)"
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
== Description == | == Description == | ||
+ | <small>WaitFor can only be used within a script.</small> | ||
+ | |||
+ | WaitFor is generally used to wait for one of several responses, through the [[ISSession:Triggers_%28Service%29|triggers service]], to an action. Script execution is paused until one of the responses is found, or the specified timeout interval elapses. WaitFor will use each possible response given as a case sensitive search string. If no timeout is given, the default is 5 seconds. The [[ISSession:WaitFor_%28Top-Level_Object%29|WaitFor Top-Level Object]] is then used to determine the result of the command. | ||
== Examples == | == Examples == | ||
+ | *Example 1 | ||
+ | Press N | ||
+ | WaitFor "You don't have one" "You drank the" | ||
+ | Switch ${WaitFor} | ||
+ | { | ||
+ | case 0: | ||
+ | echo "WaitFor Timed out" | ||
+ | break | ||
+ | case 1: | ||
+ | echo "I didn't have one!" | ||
+ | break | ||
+ | case 2: | ||
+ | echo "Phew, I drank it" | ||
+ | break | ||
+ | } | ||
+ | EndSwitch | ||
== See Also == | == See Also == |
Revision as of 05:07, 18 April 2005
Contents
Syntax
WaitFor | |
Usage | Intermediate |
Level of Understanding | Intermediate |
Computer Savvy | Intermediate |
Logic | Intermediate |
WaitFor <up to 20 things> [max wait in tenths of seconds]
Description
WaitFor can only be used within a script.
WaitFor is generally used to wait for one of several responses, through the triggers service, to an action. Script execution is paused until one of the responses is found, or the specified timeout interval elapses. WaitFor will use each possible response given as a case sensitive search string. If no timeout is given, the default is 5 seconds. The WaitFor Top-Level Object is then used to determine the result of the command.
Examples
- Example 1
Press N WaitFor "You don't have one" "You drank the" Switch ${WaitFor} { case 0: echo "WaitFor Timed out" break case 1: echo "I didn't have one!" break case 2: echo "Phew, I drank it" break } EndSwitch