Thank You, now it's working:)
But in the future - CoDeSys developers maybe should implement some way to do this without closing IDE because starting it even without UI take some time, and when it's closed we can't check what is the actual variables status.
We did already think about something like a "CoDeSys Scripting Server" which can be used to trigger scripts or other actions in an running CoDeSys IDE instance. Technically, this is easy to implement. But there are some "higher-level" problems like the question which IPC mechanism to use (TCP, or windows messages, etc.), and what to do if several CoDeSys instances are running on the same machine or even in the same user session on that machine - which instance is the one to execute the commands?
If you can live with your CoDeSys instance being blocked for user input, you can implement such a server yourself - see the topic Python and Threads
in this forum for a guy who is doing something similar. You can use IronPython to listen on some socket and receiving commands which you then execute. However, you'll most likely have to use a mix of .NET and Python standard library APIs (for example to regularly pump the message queue of the main thread), and you'll leave the "officially supported" territory.
Additionally, most runtimes support concurrent connections, so - at least in some cases - it should work to use one CoDeSys instance to monitor the variables, and another one to manipulate the application via scripting.
The whole start/stop IDE for me was needed to import and replace some modules with different parameters, because I can't change it automaticaly. E.g. I have an analog input module and using DP-Parameters it can be switched between voltage and current measurement. Unfortunately this switch I can do only manually by stopping runtime, logging out, changing desired parameter by mouse click and then login and run. This is also another tip for developers to implement some way to change the module parameter with some programming code.
We have plans to implement interfaces to configure device parameters via Python scripting, but I cannot give any concrete date yet. As a workaround, some of our customers remove() the object in question and import_native() a modified instance.
But we currently also prepare a public version of our Test Manager
(which existed as an internal product for several years now), which supports setting of device parameters. As of current planning, a beta release might be ready by the end of the year, but this is not fixed yet.
Check out the CODESYS store: http://store.codesys.com/CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions