[Open] Warn and/or Prevent entry of Duplicate Labels

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

[Open] Warn and/or Prevent entry of Duplicate Labels

Post by jpuziano » Fri Feb 12, 2010 11:37 pm

Hi Marcus,

From this post from Phil here: Slight problem with GOTO the problem turned out to be the accidental use of duplicate Labels in his macro. This can cause strange results when the macro runs ranging from complete failure or worse... intermittent problems which may be hard to spot... and I'm sure many of us have had this happen before.
mtettmar wrote:Goto will always go to the first matching label. Duplicate labels is a no-no and I suppose Macro Scheduler really ought to not even let you create a duplicate label.
Please add a feature that would warn us when we had duplicate Labels... perhaps when saving the macro.

Or, even better, warn about the second Label> line as soon as it was entered in the Macro Scheduler editor.

Let's say the line below was already in the macro many lines up... and now I just used the same label... and had just finished typing the "d" in end:

Label>end

Since that label already exists... your editor at that point could recognize that and perhaps change the color of that text to some unusual warning color... and temporarily change the message in the syntax checker info line at the bottom of the screen to "LABEL ALREADY EXISTS" or "Label>end NOT ALLOWED - ALREADY EXISTS".

At that point, the user would see the problem and could change that Label name... perhaps just adding a 2 on the end like so...

Label>end2

As soon as the 2 was typed, you editor could see that this is now a unique label, change the color of the text back to normal and change the syntax checker info line at the bottom of the screen back to what it would normally say.

This enhancement request is somewhat related to this other one:

[Open] Can GoSub throw error if duplicate Sub names found?
http://www.mjtnet.com/forum/viewtopic.php?t=4585

Both suggest having Macro Scheduler itself (probably the editor) check for certain errors and preventing them early while we're creating the macro... rather than allowing the errors through and then the user spending time later debugging and looking for the problem.

The above is just a thought as to how it might work... as I am not sure if it is possible with your editor... but whatever method you can come up with to warn/catch/prevent these simple errors would be just fine... and appreciated.

Thanks for listening and take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts