<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Update a string with procedure - Issue in Maya Forum</title>
    <link>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924767#M8494</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;Yes I tested this too and it did not work, but I guess this was, because I had already declared the variable based on your example code and would have needed to close and reopen Maya.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 00:40:06 GMT</pubDate>
    <dc:creator>mspeer</dc:creator>
    <dc:date>2022-02-03T00:40:06Z</dc:date>
    <item>
      <title>Update a string with procedure - Issue</title>
      <link>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924537#M8490</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my issue, I want to create a tool to change a string Value:&lt;/P&gt;&lt;P&gt;Theoric Example: &amp;nbsp; Variable called &amp;nbsp;"Name One"&lt;/P&gt;&lt;P&gt;Click on the tool to update Variable in "Name Two"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MEL Script:&lt;/P&gt;&lt;P&gt;string $Target = "NAME_ONE";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;string $window = `window -title "Long Name"&lt;BR /&gt;-iconName "Short Name"&lt;BR /&gt;-widthHeight 200 55`;&lt;BR /&gt;columnLayout -adjustableColumn true;&lt;BR /&gt;button -label "Change Name" -command "NewName($Target)";&lt;BR /&gt;button -label "Close" -command ("deleteUI -window " + $window);&lt;BR /&gt;setParent ..;&lt;BR /&gt;showWindow $window;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc NewName(string $Target){&lt;BR /&gt;$Target = "NAME_TWO";&lt;BR /&gt;print $Target;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;print $Target;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;During the procedure, it seems to work, nut as soon as I print $Target again, it remains, "Object_One"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone would know a trick?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 22:04:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924537#M8490</guid>
      <dc:creator>t.pansiot</dc:creator>
      <dc:date>2022-02-02T22:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update a string with procedure - Issue</title>
      <link>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924648#M8491</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;global proc string NewName(string $name){
$name = "NAME_TWO";
return $name;
}

NewName("whatever");
print `NewName("whatever")`;
print (NewName("whatever"));&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Feb 2022 23:03:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924648#M8491</guid>
      <dc:creator>mspeer</dc:creator>
      <dc:date>2022-02-02T23:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update a string with procedure - Issue</title>
      <link>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924655#M8492</link>
      <description>&lt;P&gt;Here is the solutions: string should be "global string" and it should be called inside the proc like this:&lt;/P&gt;&lt;P&gt;global string $Target = "NAME_ONE";&lt;/P&gt;&lt;P&gt;string $window = `window -title "Long Name"&lt;BR /&gt;-iconName "Short Name"&lt;BR /&gt;-widthHeight 200 55`;&lt;BR /&gt;columnLayout -adjustableColumn true;&lt;BR /&gt;button -label "Change Name" -command "NewName()";&lt;BR /&gt;button -label "Close" -command ("deleteUI -window " + $window);&lt;BR /&gt;setParent ..;&lt;BR /&gt;showWindow $window;&lt;BR /&gt;&lt;BR /&gt;global proc NewName(){&lt;BR /&gt;global string $Target ;&lt;BR /&gt;$Target = "NAME_TWO";&lt;BR /&gt;print $Target;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;print $Target;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 23:08:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924655#M8492</guid>
      <dc:creator>t.pansiot</dc:creator>
      <dc:date>2022-02-02T23:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update a string with procedure - Issue</title>
      <link>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924656#M8493</link>
      <description>Thanks a lot Mspeer, I found a solution bellow&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Feb 2022 23:09:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924656#M8493</guid>
      <dc:creator>t.pansiot</dc:creator>
      <dc:date>2022-02-02T23:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Update a string with procedure - Issue</title>
      <link>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924767#M8494</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;Yes I tested this too and it did not work, but I guess this was, because I had already declared the variable based on your example code and would have needed to close and reopen Maya.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 00:40:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/update-a-string-with-procedure-issue/m-p/10924767#M8494</guid>
      <dc:creator>mspeer</dc:creator>
      <dc:date>2022-02-03T00:40:06Z</dc:date>
    </item>
  </channel>
</rss>

