cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

How to Start/Stop a IDE script from PLC

Fred74
New Poster

How to Start/Stop a IDE script from PLC

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

Tags (1)
5 REPLIES 5
CodeShepherd
Community Moderator

Re: How to Start/Stop a IDE script from PLC

You can use the CXA_PYTHON library:

CodeShepherd_0-1628175138314.png

 

Or use the REST API of the Data Layer with standart CXA_Datalayer

CodeShepherd_1-1628175387195.png

CodeShepherd_0-1628175590260.png

 

 

 

Fred74
New Poster

Re: How to Start/Stop a IDE script from PLC

What should I copy inside those 2 following inputs :

-Instance Name 

- File Name 

PS : I use your "DevelopR" example

CodeShepherd
Community Moderator

Re: How to Start/Stop a IDE script from PLC

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);
aFouraker
Long-established Member

Re: How to Start/Stop a IDE script from PLC

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

aFouraker_0-1631032748018.png

 

CodeShepherd
Community Moderator

Re: How to Start/Stop a IDE script from PLC

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.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist