However, my script encounters an error when i use such scheme.
The error message is :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
It seems to happen on the following lines :
app = found
creates that error than you didn't find any objects with the specified name or the specified path (array of names). I used this variant of the method find(...)
so I can specify the complete path of the object.
Do you know where i can found inputs and outputs définitions for methods such as proj.find or projects.primary ? I don't find any description and, or examples in Script Engine API reference and in Python documentation. Where should I search ?
The documentation of the Scripting API is in the file "ScriptEngine.chm" which is in the sub directory "Online Help" of the CODESYS directory. With CODESYS V3.5 SP11 we will add an introduction to the ScriptEngine/Scripting to our Online Help.
I think the line :
found = proj.find("Device", "PLC Logic", "Application")
is used to get the application GUID, isn't it ?
No, it is used to specify the complete path of an object. If you used proj.find("Application", True)
and you have more than object with the name "Application" you get an array with more than one entry.
How can i get GUID of an application from the application name in the Codesys project tree ?
All script object of the project tree have a property guid
which return the GUID of the object. But you don't need the GUID of the appliction to use online.create_online_application(...)
because you can also use the script object of the application to get the corresponding online application object.
Check out the CODESYS store: http://store.codesys.com/CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions