18.01.2015 Views

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix: Built-in Scripting Language<br />

• If the function was called with no parameters…<br />

RunGlobalProcedureAsyncGetStatus( )<br />

…then the returned value is the total number of threads that are currently running.<br />

• If the function was called with only the optNumThreadID parameter…<br />

RunGlobalProcedureAsyncGetStatus( optNumThreadID )<br />

…then the returned value is either 0, indicating that the thread is still running, or the value that was<br />

returned by the procedure.<br />

• If the function was called with the Array tags…<br />

RunGlobalProcedureAsyncGetStatus( "optTagThreadIDs", "optTagStatus",<br />

"optTagParameters" )<br />

…then the tags will receive the appropriate values for all currently running and recently completed<br />

threads.<br />

If the function fails, then it returns one of the following errors:<br />

Value<br />

Description<br />

-1 Function is not supported on Viewer / Web Thin Client.<br />

-2 Invalid thread ID.<br />

-3 Invalid optTagThreadIDs.<br />

-4 Invalid optTagStatus.<br />

-5 Invalid optTagParameters.<br />

-100 Internal error. Please contact technical support.<br />

Notes<br />

It is very important to note that this function can only be called by background tasks (e.g., Math, Script,<br />

Scheduler) on the project server. It cannot be directly called from any project client, even if the project client<br />

is running on the same workstation or device as the project server, because the client process is singlethreaded.<br />

To indirectly call the function from a project client, configure a Math or Script worksheet to execute<br />

on a tag/expression trigger, and then configure a project screen to activate the trigger when needed. For<br />

example, configure the worksheet to execute when the value of MyTag is 1, and then configure a Button<br />

screen object to toggle the value of MyTag when pressed.<br />

Also, when the call to RunGlobalProcedureAsync succeeds, it returns an ID for the thread created and starts<br />

running the procedure in that thread. The status of the thread is stored in an internal buffer and can be<br />

retrieved using the RunGlobalProcedureAsyncGetStatus function. The buffer gets cleared when:<br />

• The RunGlobalProcedureAsyncGetStatus function has been called and the thread status is different<br />

from 0 (thread is running); or<br />

• The maximum buffer size has been exceeded, the thread is no longer running, and a call to start a new<br />

thread has been made.<br />

RunGlobalProcedureOnFalse<br />

This function directly executes a global procedure when the value of a specified tag/expression becomes<br />

FALSE.<br />

Function Group Execution Windows Embedded Thin Client<br />

RunGlobalProcedureOnFalse<br />

Module Activity Synchronous Supported Supported Supported<br />

Page 612<br />

<strong>InduSoft</strong> Web Studio

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!