Prototype
subroutine EcsReStart ( integer:ErrorLevel )
Description
This routine attempts to re-initialize the Ecs stimulus library. The routine can be called, if an attempt to connect to a session fails due to the associated emulator not being loaded. This routine returns an integer parameter that will be ECS_E_ERRORFREE (i.e. zero) if the library has initialized. As this routine terminates all communication with connected sessions, it should only be called at the start of the Esl Application, before any sessions have been successfully connected using the EcsConnect routine.
Parameters
ErrorLevel |
Output |
An integer error code that will be zero (ECS_E_ERRORFREE) if the Ecs facility is able to initialize the EHLLAPI library. |
Return Value
ECS_E_NOTINIT |
Not initialized - unable to initialize EHLLAPI library, Emulator not running. |
ECS_E_CANTINIT |
Cannot Initialize - Unable to allocation control block.. |
ECS_E_ERRORFREE |
No errors were generated |
Example
###*************************************
### Action to Start an Emulator session
###*************************************
action StartEmulator is
copy text of SessionName_SB in Connect_DB to ShortSessionName_SV
copy "%HomeDrive%%HomePath%\\My Documents\\Attachmate\\Sessions\\Session "
ShortSessionName_SV ".edp" to SessionFile_SV
call OS_ExpandEnvironment(SessionFile_SV, SessionFile_SV)
copy "invoke" to Call_SV
invoke "\"C:\\Program Files\\Attachmate\\E!E2K\\EXTRA.EXE\"" SessionFile_SV
if (errorlevel = 0) then
copy ECS_E_NOTINIT to ErrorLevel_IV
copy 5 to Count_IV
while (ErrorLevel_IV != ECS_E_ERRORFREE) loop
wait 1
copy "EcsReStart" to Call_SV
call EcsReStart(ErrorLevel_IV)
if (ErrorLevel_IV = ECS_E_ERRORFREE) then
copy "EcsConnect" to Call_SV
call EcsConnect (ShortSessionName_SV)
copy errorlevel to ErrorLevel_IV
end if
copy (Count_IV - 1) to Count_IV
if (Count_IV = 0) then
leave loop
end if
end loop
end if
if (ErrorLevel_IV = ECS_E_ERRORFREE) then
copy "Connect was successful" to Message_SV
action DisplayMessage
enable item EmulatorChoice in Primary_GR
call EcsGetSessionInfo ( ShortSessionName_SV, SessionType_IV, SessionRows_IV, SessionColumns_IV )
copy SessionRows_IV to MaxRows_IV
copy SessionColumns_IV to MaxColumns_IV
else
action DisplayError
end if