Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
DBaur hat geschrieben:
Hi support team,
is it possible to add a POU (e.g. prg_myCalls) call via python script to a dadicated task "task03" within the task configuration?
Thanks in advance.
_
M.Keller hat geschrieben:
Hi DBaur.
There is no Scripting API for creating and manipulating the task configuration at the moment, but it is already listed in our Jira tracker CDS-34234. It is requested for CODESYS V3.5 SP10 so maybe it will be released with the SP10 release.
If you really need it now, you could export the task configuration with PLCopenXML, change the configuration in the XML and import it.
BR
Martin
In the JIRA ticket the resolution is fixed for SP 10, but i can't find anything in the online help. Could you provide me an example for adding and manipulating tasks ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PLKM hat geschrieben:
In the JIRA ticket the resolution is fixed for SP 10, but i can't find anything in the online help. Could you provide me an example for adding and manipulating tasks ?
It seems the Scripting API documentation was not updated.
I attached an example which prints the tasks of the application "Application" and create a set of task below the application "App" which has no task configuration. See screenshot.
M.Keller hat geschrieben:
Hi PLKM.
It seems the Scripting API documentation was not updated.
I attached an example which prints the tasks of the application "Application" and create a set of task below the application "App" which has no task configuration. See screenshot.
BR
Martin
Hi Martin,
thank you for the example. But the part of adding/getting POUs within the tasks is missing. Could you provide the method ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PLKM hat geschrieben:
But the part of adding/getting POUs within the tasks is missing. Could you provide the method ?
defprintTaskPOUs(pous):
  ifpousandlen(pous)>0:
    forpouinpous:
      print("POU: "+pou)
  else:
    print("No POUs")
print("Add to two POUs ...")task.pous.add("MyPRG")task.pous.add("MyPRG2")printTaskPOUs(task.pous)print("Insert POU 'PLC_PRG' at the top ...")task.pous.insert(0,"PLC_PRG")printTaskPOUs(task.pous)
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
M.Keller hat geschrieben:
Hi PLKM.
It seems the Scripting API documentation was not updated.
I attached an example which prints the tasks of the application "Application" and create a set of task below the application "App" which has no task configuration. See screenshot.
BR
Martin
The given code is not running... It shows the following error:'ScriptObject' object has no attribute 'create_task_configuration'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi support team,
is it possible to add a POU (e.g. prg_myCalls) call via python script to a dadicated task "task03" within the task configuration?
Thanks in advance.
_
Hi DBaur.
CDS-34234
If you really need it now, you could export the task configuration with PLCopenXML, change the configuration in the XML and import it.
BR
Martin
In the JIRA ticket the resolution is fixed for SP 10, but i can't find anything in the online help. Could you provide me an example for adding and manipulating tasks ?
Hi PLKM.
It seems the Scripting API documentation was not updated.
I attached an example which prints the tasks of the application "Application" and create a set of task below the application "App" which has no task configuration. See screenshot.
BR
Martin
taskconfig example.py [2.44 KiB]
Hi Martin,
thank you for the example. But the part of adding/getting POUs within the tasks is missing. Could you provide the method ?
Hi PLKM.
BR
Martin
The given code is not running... It shows the following error:'ScriptObject' object has no attribute 'create_task_configuration'