<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/</id><updated>2020-02-27T14:55:35.367000Z</updated><subtitle>Recent posts to Modify GVL constant variable</subtitle><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#4a21" rel="alternate"/><published>2020-02-27T14:55:35.367000Z</published><updated>2020-02-27T14:55:35.367000Z</updated><author><name>dam</name><uri>https://forge.codesys.com/u/dam/</uri></author><id>https://forge.codesys.com1ee93ad6fba087ab76a645a2c63a5c0441d79663</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ok thank you M.Schaber and M.Keller.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#1289" rel="alternate"/><published>2020-02-27T14:55:34.778000Z</published><updated>2020-02-27T14:55:34.778000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comfeaeba1626406600e7873e78500215b154e9643f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; M.Schaber&lt;/p&gt;
&lt;p&gt;Hi, Dam,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;dam hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Thank you for the information and I confirm that it works with Codesys 3.5.7 but it does not work with SoMachine 4.1&lt;br/&gt;
In fact, I was confused and I tested on Codesys 3.5.7  on SoMachine 4.1. With SoMachine I do not have has_textual_declaration (it usesScriptEngine v3.5.3). &lt;br/&gt;
Is it possible to update ScriptEngine to a newer version in SoMachine or use a different API?&lt;br/&gt;
Regards&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Updating the ScriptEngine to a newer version cannot be done by a SoMachine enduser, this must be done by Schneider Electric.&lt;/p&gt;
&lt;p&gt;As far as I remember, Schneider also added some of their own extensions to the ScriptEngine, but I'm not sure whether that was for SoMachine or SoMachine Motion, and which version. I guess you need to ask the Schneider Support contact...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#75e0" rel="alternate"/><published>2020-02-27T14:55:34.202000Z</published><updated>2020-02-27T14:55:34.202000Z</updated><author><name>dam</name><uri>https://forge.codesys.com/u/dam/</uri></author><id>https://forge.codesys.comad29e33e42b14f4eb77c76876da63492472bfb6d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you for the information and I confirm that it works with Codesys 3.5.7 but it does not work with SoMachine 4.1&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;dam hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Indeed gvl.has_textual_declaration returns True but I do not have the text property.&lt;br/&gt;
I am using SoMachine 4.1 so maybe the version of Codesys is too old?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In fact, I was confused and I tested on Codesys 3.5.7 &lt;strong&gt;not&lt;/strong&gt; on SoMachine 4.1. With SoMachine I do not have has_textual_declaration (it usesScriptEngine v3.5.3). &lt;br/&gt;
Is it possible to update ScriptEngine to a newer version in SoMachine or use a different API?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#ee9d" rel="alternate"/><published>2020-02-27T14:55:32.567000Z</published><updated>2020-02-27T14:55:32.567000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com8ef747f07b4d4f90db17bec1a77e0d5c8bc86205</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi dam&lt;/p&gt;
&lt;p&gt;Sorry, my fault.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;dam hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Indeed gvl.has_textual_declaration returns True but I do not have the text property.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;First you have to get the IScriptTextDocument object through the property  (see interface IScriptObjectWithTextualDeclaration ) and than you can use  or  on that object.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#dc5a" rel="alternate"/><published>2020-02-27T14:55:31.985000Z</published><updated>2020-02-27T14:55:31.985000Z</updated><author><name>dam</name><uri>https://forge.codesys.com/u/dam/</uri></author><id>https://forge.codesys.com777602e750ec393aa197f34d6dffc5798faa9008</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Indeed gvl.has_textual_declaration returns True but I do not have the text property.&lt;br/&gt;
I am using SoMachine 4.1 so maybe the version of Codesys is too old?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#3fcb" rel="alternate"/><published>2020-02-27T14:55:31.284000Z</published><updated>2020-02-27T14:55:31.284000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com353f1a117c8953b8b6705285a85c009e9439622f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi dam.&lt;/p&gt;
&lt;p&gt;From your second post in this thread:&lt;/p&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="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_textual_declaration&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Please remove the brackets after  because it is a property and not a method. This property is only to check if the object has an ST based declaration. You get the text with the property , e.g. gvl.text, and modify it with one of the methods, e.g. gvl.replace(modifiedDeclaration).&lt;/p&gt;
&lt;p&gt;From your third post:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_children&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;With  you can only get the children of the object in the project structure. But variables are not children of the GVL object. You can only read or modify the ST based declaration.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#ae83" rel="alternate"/><published>2020-02-27T14:55:29.567000Z</published><updated>2020-02-27T14:55:29.567000Z</updated><author><name>dam</name><uri>https://forge.codesys.com/u/dam/</uri></author><id>https://forge.codesys.combdc423d5d2513b77024ccbb18aa752e23239b585</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;To add more informations if I do:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;export_native&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"my_file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I got all the values of GVL but:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_children&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;returns an empty list.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#5ca8" rel="alternate"/><published>2020-02-27T14:55:28.915000Z</published><updated>2020-02-27T14:55:28.915000Z</updated><author><name>dam</name><uri>https://forge.codesys.com/u/dam/</uri></author><id>https://forge.codesys.com3f1aa2865fe9a655a13d9f73e725da22616700f8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I tried to do:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;gvl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'GVL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;True&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="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_textual_declaration&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;but it failed as gvl is a ScriptObject.&lt;br/&gt;
Any hint?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#c736" rel="alternate"/><published>2020-02-27T14:55:28.334000Z</published><updated>2020-02-27T14:55:28.334000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.come38726f9c8080309fc91d94c1b683622c378d171</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi dam.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;dam hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
I would like to know if it is possible to modify a GVL constant variable via a python script?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You have to find the GVL object, which contains the variable(s) you want to change, and then you can either export, edit the XML and re-import the object or you can use the interface  to modify the structured text (ST) of the declaration directly.&lt;/p&gt;
&lt;p&gt;The interface  is documented in the CHM of the ScriptEngine, which you can find the OnlineHelp directory in the CODESYS base directory. All object which containt an ST based declaration and/or implementation, support the interface  so you can check for it.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modify GVL constant variable</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/442dcba365/?limit=25#72e9" rel="alternate"/><published>2020-02-27T14:55:26.723000Z</published><updated>2020-02-27T14:55:26.723000Z</updated><author><name>dam</name><uri>https://forge.codesys.com/u/dam/</uri></author><id>https://forge.codesys.come46d32bc4bd8087c4ee596bbc36f1178a0ee43e5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I would like to know if it is possible to modify a GVL constant variable via a python script?&lt;br/&gt;
If true how can I achieve this?&lt;br/&gt;
If false what should I use?&lt;/p&gt;
&lt;p&gt;In the meantime, is there a list of all available global variables in python like projects, online... ?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>