Studio:AutoScript Events: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Timeout Considerations ==
The following table describes the situations in which a timeout period applies or does not apply:
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
| width="250" bgcolor="#66ff99" | '''Action'''<br>
| width="100" bgcolor="#66ff99" | '''Timeout Period Applies'''<br>
|-
| Script is run from within another script using [[ascript#ascript.Arguments|RunBlocking()]] from Studio.
| Yes
|-
| Script is run by selecting the script in the Files Pane, right-clicking and choosing '''Run'''
| Yes
|-
| Script is run from within a test suite by clicking [[Image:RunAll.png]]
| Yes
|-
| Script is run from within an Editor window by clicking [[Image:Run.jpg]]
| No
|-
| Script is run from within another script using [[ascript#ascript.Arguments|RunNonBlocking()]] from Studio.
| No
|}
<br>
== WaitForEvent ==
== WaitForEvent ==


Line 90: Line 63:
* the configured WaitTimeoutPeriod has elapsed
* the configured WaitTimeoutPeriod has elapsed
|}
|}
[[Category:Studio:AutoScript]]

Latest revision as of 16:09, 21 August 2009

WaitForEvent

Syntax

  ascript.WaitForEvent()

Return Value

The return value is an object popped off of the front of this script's event queue. The returned object can be any of the following types. Each returned type exposes both Type and Name properties so that a script can identify the object and take appropriate action.

Object
Type
Name
Function.Owner Object "FunctionOwner" Function Name
Function.User Object "FunctionUser" Function Name
Message.Owner Object "BroadcastMessageOwner"
"OneWayMessageOwner"
"OneWayResponseOwner"
"TwoWayMessageOwner"
Message Name
Message.User Object "BroadcastMessageOwner"
"OneWayMessageOwner"
"OneWayResponseOwner"
"TwoWayMessageOwner"
Message Name
Timer Object "Timer" Timer Name
Error Object
(see Remarks)
"Error" "Host Error"
"Target Error"
"System Error"

Remarks

  • WaitForEvent() is used to provide synchronization between a script and the STRIDE Runtime when asynchronous calls are made. The synchronization is accomplished by creating a event queue for each ascript instance (typically each script has a single ascript instance). Events are pushed onto the back of the queue by the runtime, and they are popped off of the front of the queue using WaitForEvent().
  • WaitForEvent() will block script execution until an event is available in the queue.
  • You can test whether one or more events are pending in the queue by checking the IsEventPending Property.
  • An Error object is returned under the following circumstances:
 
  • a prior CallNonBlocking() or CallBypassOverrideNonBlocking() on a user function has failed to complete
  • a prior call to SendCmd() or SendCmdBypassOverride() on a user message has failed to complete
  • a prior call to Return() on an owner function that was called asynchronously has failed to complete
  • a prior call to SendRsp() on an owner message that was called asynchronously has failed to complete
  • the configured WaitTimeoutPeriod has elapsed