9.5.11 ServiceRefer (get the current status of a service)
- Purpose
-
Gets the current status of a service.
- Syntax
ServiceRefer(ServiceInfoName, StatusBuff)
- Arguments
-
- ServiceInfoName
-
Specify the name of the service information object as a character string or as a variable that stores this value.
- StatusBuff
-
Specify a variable for storing the current status. This variable stores one of the following values:
Value
Meaning
SERVICE_STOPPED
The service is not running.
SERVICE_START_PENDING
The service is starting.
SERVICE_STOP_PENDING
The service is stopping.
SERVICE_RUNNING
The service is running.
SERVICE_CONTINUE_PENDING
The service has not yet resumed.
SERVICE_PAUSE_PENDING
The service has not yet halted.
SERVICE_PAUSED
The service has temporarily halted.
- Description
-
The ServiceRefer command gets the current status of a service and stores the result in a variable.
To acquire the service status, the service name must be set in the Name keyword in the service information.
The execution result is stored in the _SVC_RTN_ reserved variable. The command returns True on successful execution, or False for all other states.
- Example
' Get the current status of the JP1/Script service, ' and activate the service. Dim svStatus ServiceSetValue("JSService", Name::"JP1_Script") ServiceRefer("JSService", svStatus) If svStatus = SERVICE_STOPPED Then ServiceStart("JSService") End
- JP1/Script version
-
Supported from JP1/Script 01-00.