Announcement

Collapse
No announcement yet.

Would like to set an alert on AND off at will.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Would like to set an alert on AND off at will.

    My following alert test must be some kind of brain teaser...
    I would think it would just work, but it just doesn't (on my machine anyway).

    // TEST ALERT
    // Set to true via Edit Studies works,
    // set BACK to false doesn't work...
    // sound still plays.

    var vPlaySound = "..\\sounds\\Drip.wav";
    var x = 0;

    function preMain() {

    setStudyTitle("test");
    setPriceStudy(true);

    var fp1 = new FunctionParameter( "vSound", FunctionParameter.BOOLEAN);
    fp1.setName("Play Sound");
    fp1.setDefault(false);

    }

    function main(vSound) {

    debugPrint("Sound = " + vSound + " ("+ x + ")\n");
    x++;

    if(vSound) {Alert.playSound(vPlaySound)};

    return;
    }


    Tried reloading script, tried capturing into another variable... no go.

    Thanks.
    -function THEO( EatingSkittles );

  • #2
    tedsmith
    You may want to see this thread with regards to Boolean parameters
    Alex

    Comment


    • #3
      Hello tedsmith,

      The boolean function parameter gets returned to main() as a string when changed via Edit Studies. I would recommend using the string type as follows.

      PHP Code:
      // TEST ALERT
      // Set to true via Edit Studies works,
      // set BACK to false doesn't work...
      // sound still plays.

      var vPlaySound "..\\sounds\\Drip.wav";
      var 
      0;

      function 
      preMain() {

      setStudyTitle("test");
      setPriceStudy(true);

      var 
      fp1 = new FunctionParameter"vSound"FunctionParameter.STRING);
      fp1.setName("Play Sound");
      fp1.addOption("true");
      fp1.addOption("false");
      fp1.setDefault("false");

      }

      function 
      main(vSound) {

      debugPrint("Sound = " vSound " ("")\n");
      x++;

      if(
      vSound == "true") {Alert.playSound(vPlaySound)};

      return;

      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        That did it! I thought I was completely off my rocker. Boolean into a string??? ...must be a feature.

        MANY THANKS!
        -function THEO( StillEatingSkittles)

        Comment

        Working...
        X