Here a working example:
VAR
fbIL_ScriptInstance: IL_ScriptInstance;
StateInstance: CXA_PYTHON.INSTANCE_STATE;
bEnableInstance: BOOL;
bInOperationInstance: BOOL;
bErrorInstance: BOOL;
ErrorIDInstance: CXA_PYTHON.ERROR_CODE;
ErrorIdentInstance: CXA_PYTHON.ERROR_STRUCT;
strInstanceName: STRING := 'MyTestInstance'; //Name of script instance to be created
bResetInstance: BOOL;
bAbortScript: BOOL;
fbIL_StartScriptFile: IL_StartScriptFile;
bExecuteFile: BOOL;
bDoneFile: BOOL;
bActiveFile: BOOL;
bErrorFile: BOOL;
ErrorIDFile: CXA_PYTHON.ERROR_CODE;
ErrorIdentFile: CXA_PYTHON.ERROR_STRUCT;
strFilePath: STRING(255) := 'activeConfiguration/test.py'; //Path to the file to be executed e.g. root folder of the active configuration
ParametersFile: ARRAY [0..9] OF STRING;
END_VAR fbIL_ScriptInstance(
Enable:= bEnableInstance,
InOperation=> bInOperationInstance,
Error=> bErrorInstance,
ErrorID=> ErrorIDInstance,
ErrorIdent=> ErrorIdentInstance,
InstanceName:= strInstanceName,
ResetInstance:= bResetInstance,
AbortScript:= bAbortScript,
State=> StateInstance);
fbIL_StartScriptFile(
Execute:= bExecuteFile,
Done=> bDoneFile,
Active=> bActiveFile,
Error=> bErrorFile,
ErrorID=> ErrorIDFile,
ErrorIdent=> ErrorIdentFile,
InstanceName:= strInstanceName,
FileName:= strFilePath,
Parameters:= ParametersFile);
... View more