<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/</id><updated>2020-02-27T14:47:57.126000Z</updated><subtitle>Recent posts to Adding a prg to a task via python script</subtitle><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#f97c" rel="alternate"/><published>2020-02-27T14:47:57.126000Z</published><updated>2020-02-27T14:47:57.126000Z</updated><author><name>aritra666</name><uri>https://forge.codesys.com/u/aritra666/</uri></author><id>https://forge.codesys.comd66cc35aec93bb385b9e8582ad31b9121635c680</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;M.Keller hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi PLKM.&lt;br/&gt;
It seems the Scripting API documentation was not updated.&lt;br/&gt;
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.&lt;br/&gt;
BR&lt;br/&gt;
Martin&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;The given code is not running... It shows the following error:'ScriptObject' object has no attribute 'create_task_configuration'&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#c787" rel="alternate"/><published>2020-02-27T14:47:56.423000Z</published><updated>2020-02-27T14:47:56.423000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.comcfe74f45649495cb1796facf4c1e33ad2add113d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi PLKM.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;PLKM hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
But the part of adding/getting POUs within the tasks is missing. Could you provide the method ?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;def&lt;/span&gt; &lt;span class="nv"&gt;printTaskPOUs&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;pous&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;:
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;pous&lt;/span&gt; &lt;span class="nv"&gt;and&lt;/span&gt; &lt;span class="nv"&gt;len&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;pous&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;:
      &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;pou&lt;/span&gt; &lt;span class="nv"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;pous&lt;/span&gt;:
         &lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;POU: &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;pou&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
   &lt;span class="k"&gt;else&lt;/span&gt;:
      &lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;No POUs&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"Add to two POUs ..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pous&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"MyPRG"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pous&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"MyPRG2"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;printTaskPOUs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pous&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"Insert POU 'PLC_PRG' at the top ..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pous&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;"PLC_PRG"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;printTaskPOUs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pous&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#020e" rel="alternate"/><published>2020-02-27T14:47:55.831000Z</published><updated>2020-02-27T14:47:55.831000Z</updated><author><name>PLKM</name><uri>https://forge.codesys.com/u/plkm/</uri></author><id>https://forge.codesys.com8fe3d50bfd67c202ee04bd5f147e3ededd3d4863</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;M.Keller hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi PLKM.&lt;br/&gt;
It seems the Scripting API documentation was not updated.&lt;br/&gt;
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.&lt;br/&gt;
BR&lt;br/&gt;
Martin&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;thank you for the example. But the part of adding/getting POUs within the tasks is missing. Could you provide the method ?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#00d9" rel="alternate"/><published>2020-02-27T14:47:54.159000Z</published><updated>2020-02-27T14:47:54.159000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.comc2e50827765a6fa00cae49fe9fd02a7ee644f5ad</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi PLKM.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;PLKM hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
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 ?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It seems the Scripting API documentation was not updated.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Scripting_TaskConfig_Example.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=2744"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=2743" rel="nofollow"&gt;taskconfig example.py &lt;span&gt;&lt;span&gt;[2.44 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#1249" rel="alternate"/><published>2020-02-27T14:47:53.584000Z</published><updated>2020-02-27T14:47:53.584000Z</updated><author><name>PLKM</name><uri>https://forge.codesys.com/u/plkm/</uri></author><id>https://forge.codesys.comb230e3e54a5b3a9642b8d723144c407a93a46030</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;M.Keller hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi DBaur.&lt;br/&gt;
There is no Scripting API for creating and manipulating the task configuration at the moment, but it is already listed in our Jira tracker &lt;a class="" href="http://jira.3s-software.com/browse/CDS-34234" rel="nofollow"&gt;CDS-34234&lt;/a&gt;. It is requested for CODESYS V3.5 SP10 so maybe it will be released with the SP10 release.&lt;br/&gt;
If you really need it now, you could export the task configuration with PLCopenXML, change the configuration in the XML and import it.&lt;br/&gt;
BR&lt;br/&gt;
Martin&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;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 ?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#52b3" rel="alternate"/><published>2020-02-27T14:47:53.010000Z</published><updated>2020-02-27T14:47:53.010000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com902978472e3de9d3b911c81856aba3fd9c0efa2d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi DBaur.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;DBaur hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi support team,&lt;br/&gt;
is it possible to add a POU (e.g. prg_myCalls) call via python script to a dadicated task "task03" within the task configuration?&lt;br/&gt;
Thanks in advance.&lt;br/&gt;
_&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a class="" href="http://jira.3s-software.com/browse/CDS-34234" rel="nofollow"&gt;CDS-34234&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you really need it now, you could export the task configuration with PLCopenXML, change the configuration in the XML and import it.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Adding a prg to a task via python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/aac2ff7b37/?limit=25#bb03" rel="alternate"/><published>2020-02-27T14:47:51.435000Z</published><updated>2020-02-27T14:47:51.435000Z</updated><author><name>DBaur</name><uri>https://forge.codesys.com/u/dbaur/</uri></author><id>https://forge.codesys.com29d18b0baa097f8d396e7787c315b00a15275a56</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi support team,&lt;/p&gt;
&lt;p&gt;is it possible to add a POU (e.g. prg_myCalls) call via python script to a dadicated task "task03" within the task configuration?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;br/&gt;
_&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>