{"id":625,"date":"2009-05-12T14:15:54","date_gmt":"2009-05-12T14:15:54","guid":{"rendered":"http:\/\/www.mjtnet.com\/blog\/?p=625"},"modified":"2009-05-12T14:15:54","modified_gmt":"2009-05-12T14:15:54","slug":"the-variable-explorer","status":"publish","type":"post","link":"https:\/\/www.mjtnet.com\/blog\/2009\/05\/12\/the-variable-explorer\/","title":{"rendered":"The Variable Explorer"},"content":{"rendered":"<p>An experienced Macro Scheduler scripter was recently trying to figure out why the following code wasn&#8217;t doing what he expected:<\/p>\n<p>If&gt;seg_1=05<br \/>\n\u00a0\u00a0Let&gt;monLtr=mm<br \/>\nEndif<\/p>\n<p>Apparantly monLtr was always being set to 05. \u00a0This told me that &#8220;mm&#8221; must have been a variable which had earlier been set to 05. \u00a0 But my friend said &#8220;I&#8217;ve looked all through the code I can&#8217;t see where &#8220;mm&#8221; is set anywhere&#8221;. \u00a0<\/p>\n<p>Then I reminded him of the Variable Explorer. \u00a0&#8220;The what?&#8221; he asked.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-626\" style=\"margin-left: 10px; margin-right: 10px;\" title=\"varexplorer\" src=\"\/\/www.mjtnet.com\/blog\/wp-content\/uploads\/2009\/05\/varexplorer.png\" alt=\"varexplorer\" width=\"285\" height=\"174\" \/>Under the editor select Tools\/Variable Explorer or hit Ctrl-Alt-V and you&#8217;ll get a box like this one. \u00a0It shows a list of all the variables created by your script. \u00a0<\/p>\n<p>Bingo! \u00a0There&#8217;s mm. \u00a0Expand it and you&#8217;ll see all the lines where it is set\/created. \u00a0 In this case it&#8217;s created on line 40 by the Min command. \u00a0<\/p>\n<p>In a long script it&#8217;s easy not to see the obvious. \u00a0The Variable Explorer makes it easier.<\/p>\n<p>Of course, it would also be sensible to use a better naming convention for the variable to avoid such confusion. \u00a0Or use VAREXPLICIT or he could have used {&#8220;mm&#8221;} to specify the literal string value. \u00a0 But don&#8217;t forget the Variable Explorer as it can save a lot of hunting around.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An experienced Macro Scheduler scripter was recently trying to figure out why the following code wasn&#8217;t doing what he expected: If&gt;seg_1=05 \u00a0\u00a0Let&gt;monLtr=mm Endif Apparantly monLtr was always being set to 05. \u00a0This told me that &#8220;mm&#8221; must have been a variable which had earlier been set to 05. \u00a0 But my friend said &#8220;I&#8217;ve looked [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,5,6],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/625"}],"collection":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/comments?post=625"}],"version-history":[{"count":2,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/625\/revisions"}],"predecessor-version":[{"id":628,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/625\/revisions\/628"}],"wp:attachment":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/media?parent=625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/categories?post=625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/tags?post=625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}