HISE Logo Forum
    • Categories
    • Register
    • Login

    How to show something only on first run?

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 347 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • hisefiloH
      hisefilo
      last edited by

      Hi guys, maybe a stupid question. How can I do to show a dialog only on the first run of a compiled plugin/app?

      At this point I'm trying this, no luck. Maybe Im doing something really stupid!

      reg myJSONObj = Engine.loadFromJSON("..//micSetup.js");
      
      if(myJSONObj == "")
      {
      
          myJSONObj = {
                   "micGainSetup": -18,
                    "lowCutSetup": 1,
                   "firstRunDone": 0
                     };
           Engine.dumpAsJSON(myJSONObj , "..//micSetup.js");
      
      };
      
      micSettingsPanel.showControl(true);
      
      inline function onsaveMicSetupControl(component, value)
      {
      	if(myJSONObj.firstRunDone == 0)
      	{     
      		micSettingsPanel.showControl(true);
      
          } else
          {
      	    micSettingsPanel.showControl(false);
          }
          
      	myJSONObj.micGainSetup = micGainSetup.getValue();
      	myJSONObj.lowCutSetup = lowCutSetup.getValue();
         	myJSONObj.firstRunDone = 1;
         	
         	Engine.dumpAsJSON(myJSONObj, "..//micSetup.js");
          
      };
      
      Content.getComponent("saveMicSetup").setControlCallback(onsaveMicSetupControl);
      
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @hisefilo
        last edited by

        @hisefilo Save the file to the appdata folder

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        hisefiloH 1 Reply Last reply Reply Quote 0
        • hisefiloH
          hisefilo @d.healey
          last edited by

          @d-healey It's already saving on appdata and Application Support

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @hisefilo
            last edited by

            @hisefilo I don't like the use of the relative path, it seems to have potential to fail. Use the file system API, and the writeObject and loadAsObject functions

            if(myJSONObj == "")
            

            Does myJSONObj equal an empty string if loadFromJSON fails? Wouldn't it be undefined?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            hisefiloH 1 Reply Last reply Reply Quote 0
            • hisefiloH
              hisefilo @d.healey
              last edited by

              @d-healey you are right! myJSONObj never is ""

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              17

              Online

              1.8k

              Users

              12.1k

              Topics

              105.4k

              Posts