| Author |
Message |
   
Douglas S. Lacey
Username: thx99
Registered: 11-2005
| | Posted on Saturday, Jan 13, 2007 - 3:40: | |
I have a large script in which a small section is designed simply to convert an integer value derived from a modulo division to an ASCII string. Unfortunately, this section is continually resulting in a "Command execution error" under certain conditions. Here's the section (line with "*" is the one it fails on): Assign TimeStampCountMod (TimeStampCount%10) IfEqual TimeStampCountMod 0 Write 0x0D Else Write 0x20 IntToStr TimeStampCountModStr TimeStampCountMod * Write TimeStampCountModStr Write "/10" Write 0x0D EndIf I've verified that the value of TimeStampCount is 297 coming into this section of the script, resulting in a modulo of 7 when dividing by 10. For the previous time through this section, TimeStampCount was 150 resulting in a modulo of 0, and no error occurred. So it seems to fail when the modulo is something other than 0. And even more strange, if I copy this section out to its own script and Assign 297 to TimeStampCount, it works flawlessly. Just within the context of the larger script it continually fails. Any ideas?? Thanks! Doug thx99@cox.net |
   
Jens Kirschner
Username: admin3
Registered: 4-2004
| | Posted on Monday, Jan 15, 2007 - 14:11: | |
Since this section of the script works correctly if used on its own (so you say yourself), I would be interested to see the rest of the script to figure out, if there is something happening elsewhere which interferes with the proper execution of this section. If you feel uncomfortable posting the script to the forum, you could also e-mail it to our admin e-mail account. |
   
Howard Atherton
Username: howard
Registered: 4-2005
| | Posted on Monday, Jan 15, 2007 - 14:27: | |
Hi Douglas & Jens I had a problem with strtoInt which Stefan corrected in later versions of Whx / XWF What version are you using? Try the latest version if not already doing so? |
   
Douglas S. Lacey
Username: thx99
Registered: 11-2005
| | Posted on Monday, Jan 15, 2007 - 16:46: | |
Thanks for the replies, Jens and Howard! I got around this error by doing the following: 1) Writing the integer value "TimeStampCount" into its own data file; 2) Pulling out the section above as a separate script which opens and reads "TimeStampCount" from the data file before execution; and 3) Executing this separate, external script at this point in the master script. May not be the most efficient way of doing things, but it works like a charm now. |
   
Stefan Fleischmann
Username: admin
Registered: 1-2001
| | Posted on Sunday, Jan 21, 2007 - 15:18: | |
Thanks for sending the entire script. I found out that the maximum number of variables permitted (32) was fully utilized at some point during script execution, and that's why IntToStr eventually failed. (IntToStr creates a variable with a name as specified by the first parameter unless it exists already.) v13.8 and later will display a more specific error message: "Unable to create another variable". Possible solution: Dispose your variables when no longer needed. Release MyVariable Specifically disposes an existing variable. Mandatory to invoke only when more than 32 variables with different names are to be used during the execution of a script, so that earlier variables that are not needed any more can be destroyed. (will be part of the documentation in v13.8 and later) |
   
Douglas S. Lacey
Username: thx99
Registered: 11-2005
| | Posted on Monday, Jan 22, 2007 - 17:06: | |
Thanks a million, Stefan, for the timely and detailed response! I honestly wasn't aware of the 32 variable maximum. The "Release" command works like a charm, once I figured out which variables I could dispose of and where to place the commands in the script.
 |
   
Douglas S. Lacey
Username: thx99
Registered: 11-2005
| | Posted on Monday, Jan 22, 2007 - 17:27: | |
Ah, never mind! Under the "Read MyVariable" command in the Scripts document: "Up to 32 different variables allowed." Amazing what one learns when one actually reads the instructions... |