<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/</id><updated>2020-02-27T15:06:41.391000Z</updated><subtitle>Recent posts to How to set values with a Test Manager Python script</subtitle><entry><title>How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/?limit=25#4246" rel="alternate"/><published>2020-02-27T15:06:41.391000Z</published><updated>2020-02-27T15:06:41.391000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com0f0b20806023509e27765b3428cfb119c886feb0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Bakkertje,&lt;/p&gt;
&lt;p&gt;you are absolutely right. I forgot to look at the API documentation. If you can't be sure that all the variables contain only strings the "str()" is necessary.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/?limit=25#81fc" rel="alternate"/><published>2020-02-27T15:06:40.670000Z</published><updated>2020-02-27T15:06:40.670000Z</updated><author><name>Bakkertje</name><uri>https://forge.codesys.com/u/bakkertje/</uri></author><id>https://forge.codesys.comcdd2f204e0239e078aff2d54d96ce504c59c4379</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;Thanks, this is useful.&lt;br/&gt;
I only have to convert the value to s string type with str() and it works.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;onlineApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_prepared_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"PLC_PRG.iVal1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iSetValue1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/?limit=25#9375" rel="alternate"/><published>2020-02-27T15:06:38.792000Z</published><updated>2020-02-27T15:06:38.792000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.come9ec0ec3c3639caf6d54a26976fb9b1a6ee7d380</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Bakkertje.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Bakkertje hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
And with the "WriteVariable" I can set one variable value. Is there a way to set more variable values with one command?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can use the Scripting API to prepare your values and send them to the PLC together. For example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;onlineApp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;online&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;create_online_application&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;onlineApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_prepared_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"PLC_PRG.iVal1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iSetValue1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;onlineApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_prepared_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"PLC_PRG.iVal2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iSetValue2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;globalVars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;executionContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GlobalVariables&lt;/span&gt;
&lt;span class="n"&gt;onlineApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_prepared_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"PLC_PRG.iVal2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;globalVars&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;"g_var1"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;onlineApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write_prepared_values&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>How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/?limit=25#ce40" rel="alternate"/><published>2020-02-27T15:06:38.113000Z</published><updated>2020-02-27T15:06:38.113000Z</updated><author><name>Bakkertje</name><uri>https://forge.codesys.com/u/bakkertje/</uri></author><id>https://forge.codesys.coma7fa5fd1a4acda46e7399614d6ff6b192a2352b5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;br/&gt;
With the "CompareVariableList" I can compare more variables in one time. That gives a good overview.&lt;br/&gt;
And with the "WriteVariable" I can set one variable value. Is there a way to set more variable values with one command?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/?limit=25#f639" rel="alternate"/><published>2020-02-27T15:06:37.486000Z</published><updated>2020-02-27T15:06:37.486000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com468c060e12d6ecdf74743bd4e1c88c38bc151627</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Bakkertje.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
How can I set values for testing with a Test Manager Python script?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What do you mean?&lt;/p&gt;
&lt;p&gt;If you want to set the value of a script variable you use an ASSIGNMENT. You can use it again if you want to change the value. For example, you want to call the same test script but with different values.&lt;/p&gt;
&lt;p&gt;If you want to set the value of an IEC variable on the PLC, you have to use one of the commands from TestManager.Monitoring or use the Scripting API in a test action with the command ExecuteScript from TestManager.Scripting.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to set values with a Test Manager Python script</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e35838fc66/?limit=25#cab7" rel="alternate"/><published>2020-02-27T15:06:35.705000Z</published><updated>2020-02-27T15:06:35.705000Z</updated><author><name>Bakkertje</name><uri>https://forge.codesys.com/u/bakkertje/</uri></author><id>https://forge.codesys.com916c94fb78e0f28b897750ab50670f2e34743752</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;How can I set values for testing with a Test Manager Python script?&lt;br/&gt;
See the screen copy below this question.&lt;/p&gt;
&lt;p&gt;The next software is used: Codesys V3.5 SP7 Patch 2 and Test Manager 4.0.1.1.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: TestManager_SetValueWithPythonScript.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=1468"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>