Use scrip.abort(false) to skip single scripts in batch


Author
Message
pinguin
pinguin
Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)
Group: Forum Members
Posts: 24, Visits: 133
Dear all,

we are trying to implement a „menu“ so that our testing personnel can choose where to start the test battery.

To do so, we thought of implementing something similar to this: https://forums.millisecond.com/Topic23921.aspx#23934

The basic logic should be that:

- For menu_choice 1 or 2, all scripts after the menu script are presented.
- For menu_choice 3, modul1 shall be skipped, but the rest be presented.
- For menu_choice 4, modul1 and modul2 shall be skipped, but the rest presented.
- For menu_choice 5, modul1, modul2, and modul3 shall be skipped, but the rest be presented.
- For menu_choice 6, no script after the menu shall be presented at all.

This is our batch:

<parameters>
/ vpcode_hd2 = 0
/ menu_choice = 0 //corresponds to test_sequence
</parameters>

<values>
/ vpcode_hd1 = 0
/ test_sequence = 0 //corresponds to menu_choice
</values>

<batch multigroup>
/ file = "vpcode.iqjs"
/ file = "pinguin_menu.iqjs"
/ file = "modul1.iqjs"
/ file = "modul2.iqjs"
/ file = "modul3.iqjs"
/ file = "modul4.iqjs"

/ onScriptEnd = {
  if (batch.multigroup.currentScript == "vpcode.iqjs") {
   parameters.vpcode_hd2 = values.vpcode_hd1;
  }
  if (batch.multigroup.currentScript == "pinguin_menu.iqjs") {
   parameters.menu_choice = values.test_sequence;
  }
}

</batch>

Depending on the menu_choice parameter, the respective scripts within our batch should be script.abort(false).

In modul1.iqjs, for example, the expt looks like this:

<expt myExpt>

/ onExptBegin = {
  values.vpcode_hd1 = parameters.vpcode_hd2;
  values.test_sequence = parameters.menu_choice;

  if (parameters.menu_choice != 1 && parameters.menu_choice != 2) {
   script.abort(false);
  }
}

/ preInstructions = (myPage)
/ blocks = [1=myBlock]
</expt>

For modul2.iqjs it looks like this:

<expt myExpt>

/ onExptBegin = {
  values.vpcode_hd1 = parameters.vpcode_hd2;
  values.test_sequence = parameters.menu_choice;

    if (parameters.menu_choice != 1 && parameters.menu_choice != 2 && parameters.menu_choice != 3) {
   script.abort(false);
  }
}

/ preInstructions = (myPage)
/ blocks = [1=myBlock]
</expt>

However, as soon as menu_choice exceeds a value of 2, none of the respective modules is shown.

What are we missing?

(The scripts are a mock-up and can be downloaded here: https://tinyurl.com/iqtestmodul)

Best,

pinguin
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
pinguin - 7/30/2025
Dear all,

we are trying to implement a „menu“ so that our testing personnel can choose where to start the test battery.

To do so, we thought of implementing something similar to this: https://forums.millisecond.com/Topic23921.aspx#23934

The basic logic should be that:

- For menu_choice 1 or 2, all scripts after the menu script are presented.
- For menu_choice 3, modul1 shall be skipped, but the rest be presented.
- For menu_choice 4, modul1 and modul2 shall be skipped, but the rest presented.
- For menu_choice 5, modul1, modul2, and modul3 shall be skipped, but the rest be presented.
- For menu_choice 6, no script after the menu shall be presented at all.

This is our batch:

<parameters>
/ vpcode_hd2 = 0
/ menu_choice = 0 //corresponds to test_sequence
</parameters>

<values>
/ vpcode_hd1 = 0
/ test_sequence = 0 //corresponds to menu_choice
</values>

<batch multigroup>
/ file = "vpcode.iqjs"
/ file = "pinguin_menu.iqjs"
/ file = "modul1.iqjs"
/ file = "modul2.iqjs"
/ file = "modul3.iqjs"
/ file = "modul4.iqjs"

/ onScriptEnd = {
  if (batch.multigroup.currentScript == "vpcode.iqjs") {
   parameters.vpcode_hd2 = values.vpcode_hd1;
  }
  if (batch.multigroup.currentScript == "pinguin_menu.iqjs") {
   parameters.menu_choice = values.test_sequence;
  }
}

</batch>

Depending on the menu_choice parameter, the respective scripts within our batch should be script.abort(false).

In modul1.iqjs, for example, the expt looks like this:

<expt myExpt>

/ onExptBegin = {
  values.vpcode_hd1 = parameters.vpcode_hd2;
  values.test_sequence = parameters.menu_choice;

  if (parameters.menu_choice != 1 && parameters.menu_choice != 2) {
   script.abort(false);
  }
}

/ preInstructions = (myPage)
/ blocks = [1=myBlock]
</expt>

For modul2.iqjs it looks like this:

<expt myExpt>

/ onExptBegin = {
  values.vpcode_hd1 = parameters.vpcode_hd2;
  values.test_sequence = parameters.menu_choice;

    if (parameters.menu_choice != 1 && parameters.menu_choice != 2 && parameters.menu_choice != 3) {
   script.abort(false);
  }
}

/ preInstructions = (myPage)
/ blocks = [1=myBlock]
</expt>

However, as soon as menu_choice exceeds a value of 2, none of the respective modules is shown.

What are we missing?

(The scripts are a mock-up and can be downloaded here: https://tinyurl.com/iqtestmodul)

Best,

pinguin

The code in the folder you linked doesn't match the code in your post. So which version is it you are referring to?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
Dave - 7/30/2025
pinguin - 7/30/2025
Dear all,

we are trying to implement a „menu“ so that our testing personnel can choose where to start the test battery.

To do so, we thought of implementing something similar to this: https://forums.millisecond.com/Topic23921.aspx#23934

The basic logic should be that:

- For menu_choice 1 or 2, all scripts after the menu script are presented.
- For menu_choice 3, modul1 shall be skipped, but the rest be presented.
- For menu_choice 4, modul1 and modul2 shall be skipped, but the rest presented.
- For menu_choice 5, modul1, modul2, and modul3 shall be skipped, but the rest be presented.
- For menu_choice 6, no script after the menu shall be presented at all.

This is our batch:

<parameters>
/ vpcode_hd2 = 0
/ menu_choice = 0 //corresponds to test_sequence
</parameters>

<values>
/ vpcode_hd1 = 0
/ test_sequence = 0 //corresponds to menu_choice
</values>

<batch multigroup>
/ file = "vpcode.iqjs"
/ file = "pinguin_menu.iqjs"
/ file = "modul1.iqjs"
/ file = "modul2.iqjs"
/ file = "modul3.iqjs"
/ file = "modul4.iqjs"

/ onScriptEnd = {
  if (batch.multigroup.currentScript == "vpcode.iqjs") {
   parameters.vpcode_hd2 = values.vpcode_hd1;
  }
  if (batch.multigroup.currentScript == "pinguin_menu.iqjs") {
   parameters.menu_choice = values.test_sequence;
  }
}

</batch>

Depending on the menu_choice parameter, the respective scripts within our batch should be script.abort(false).

In modul1.iqjs, for example, the expt looks like this:

<expt myExpt>

/ onExptBegin = {
  values.vpcode_hd1 = parameters.vpcode_hd2;
  values.test_sequence = parameters.menu_choice;

  if (parameters.menu_choice != 1 && parameters.menu_choice != 2) {
   script.abort(false);
  }
}

/ preInstructions = (myPage)
/ blocks = [1=myBlock]
</expt>

For modul2.iqjs it looks like this:

<expt myExpt>

/ onExptBegin = {
  values.vpcode_hd1 = parameters.vpcode_hd2;
  values.test_sequence = parameters.menu_choice;

    if (parameters.menu_choice != 1 && parameters.menu_choice != 2 && parameters.menu_choice != 3) {
   script.abort(false);
  }
}

/ preInstructions = (myPage)
/ blocks = [1=myBlock]
</expt>

However, as soon as menu_choice exceeds a value of 2, none of the respective modules is shown.

What are we missing?

(The scripts are a mock-up and can be downloaded here: https://tinyurl.com/iqtestmodul)

Best,

pinguin

The code in the folder you linked doesn't match the code in your post. So which version is it you are referring to?

In any case, it's actually very simple. To achieve

- For menu_choice 1 or 2, all scripts after the menu script are presented.
- For menu_choice 3, modul1 shall be skipped, but the rest be presented.
- For menu_choice 4, modul1 and modul2 shall be skipped, but the rest presented.
- For menu_choice 5, modul1, modul2, and modul3 shall be skipped, but the rest be presented.
- For menu_choice 6, no script after the menu shall be presented at all.


you simply do:

    // Abort if menu_choice is 3, 4, 5, or 6
    if (parameters.menu_choice > 2) {
        script.abort(false);
    }


in module 1,

    // Abort if menu_choice is 4, 5, or 6
    if (parameters.menu_choice > 3) {
        script.abort(false);
    }


in module 2,

    // Abort if menu_choice is 5 or 6
    if (parameters.menu_choice > 4) {
        script.abort(false);
    }


in modul 3, and finally

    // Abort if menu_choice is 6
    if (parameters.menu_choice > 5) {
        script.abort(false);
    }


in module 4.

Though you could forego that last one and just abort straight away /onExptEnd in pinguin_menu.iqls.

/ onExptEnd = {
    if (values.test_sequence > 5) {
        script.abort(true);
    }
}


pinguin
pinguin
Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)Associate Member (108 reputation)
Group: Forum Members
Posts: 24, Visits: 133
Dear Dave,

sorry; for some reason the link doesn't even work anymore.

You understood it anyways and your response helped. It works now. Thank you! 

Best,

pinguin

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search