Gotoif vs Gotolabel execution bug?

I’ve noticed that gotoif doesn’t work if I store the label name inside a variable, but gotolabel works fine under the same circumstances. I provided a small test macro below to show what happens with both, is this a bug or am I missing something?

{
  "Name": "TEMPORARY 2",
  "CreationDate": "2021-10-9",
  "Commands": [
    {
      "Command": "store",
      "Target": "medium",
      "Value": "!replayspeed",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "Test1",
      "Value": "Label1",
      "Description": ""
    },
    {
      "Command": "gotoLabel",
      "Target": "${Label1}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "skipthis",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "label",
      "Target": "Test1",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "Test2",
      "Value": "Label2",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "Skip",
      "Description": ""
    },
    {
      "Command": "gotoIf_v2",
      "Target": "${Skip} == 1",
      "Value": "${Label2}",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "skipthis",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "label",
      "Target": "Test2",
      "Value": "",
      "Description": ""
    }
  ]
}

GotoLabel/GotoIf with a $variable as destination is not supported by design. So it not supposed to work => So the bug here is the lack of a proper error message :wink:

But what you want to achieve? I am sure there is another way to do it (and if not, we will add it).

Thank you for following up and appreciate the info. GotoIf is the same as GotoLabel inside an if statement and GotoLabel works with a $variable so that’s what I ended up doing, I was just surprised when the initial macro I wrote didn’t work the way I intended it to and wanted to let you know in case it wasn’t a feature but a bug :slightly_smiling_face: That said, you just said GotoLabel doesn’t work with a $variable as destination, it actually does (and I’m very happy about that), so was it not supposed to? I strongly believe that flow control should support $variables as much as possible so that blocks of code can be reused in different parts of the macro without having to write it out every time. For example: I put an error handling block inside an if statement that has 1<0 as the condition, a label to get in and a gotolabel with $destination to get out, so that when it gets executed it deals with the error and goes back to where it came from to continue the rest of the macro as if nothing went wrong in the first place

I’m aware I can call another macro inside the main one, but I find it easier to manage when everything is contained within a single macro

Ok, understood. Thanks for the feedback!

Just for your information: If you ZIP export a macro the zip-archive contains all used images, CSV files and all sub-macros needed by the main macro. I mention this just as a hint if you need to move macros between machines.