FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
08-05-2021 04:16 PM
I would like to start and Stop the IDE scritp from the PLC. Which FB from which lib should I use.
MAny thanks for your help
Frédéric
Solved! Go to Solution.
08-05-2021 04:58 PM - edited 08-05-2021 05:00 PM
You can use the CXA_PYTHON library:
Or use the REST API of the Data Layer with standart CXA_Datalayer
08-06-2021 02:07 PM
What should I copy inside those 2 following inputs :
-Instance Name
- File Name
PS : I use your "DevelopR" example
08-10-2021 02:07 PM
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);
09-07-2021 06:40 PM
This is not very clearly explained in the IDE manual (R911410625, Edition 02, image below). When deploying to the target it would appear that the file path is
/skripts/Bosch/TIGER/application.py when in reality the path that works is /activeConfiguration/scripts/bosch/tiger/application.py
09-08-2021 08:05 AM
The path changed during development and is now always the active configuration for all our our apps. This has to be changed in the documentation thanks for mentioning.
10-29-2021 08:21 AM
Hello,
I have been trying to Start the IDE Project in the PLC application but every time I execute the StartScriptFile FB the StateInstance changes to "Error" and the ctrlX Core returns a 081F2001 Error. It seems that the EnableInstance FB creates successfully the instance, as I can see it in the Datalayer but every time I start the script it returns this error,
Attached the pictures,
Does anyone know why is this happening?
Thanks for the help,
10-29-2021 04:34 PM
Check out the link here
Look at C0270302. Looks like maybe there is a script error.
Script runner could not execute the script
Cause/Remedy 1: Cause: The script interpreter has detected errors in the script. Remedy: Correct your script file.