How to show something only on first run?
-
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);
-
@hisefilo Save the file to the appdata folder
-
@d-healey It's already saving on appdata and Application Support
-
@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
andloadAsObject
functionsif(myJSONObj == "")
Does myJSONObj equal an empty string if loadFromJSON fails? Wouldn't it be undefined?
-
@d-healey you are right! myJSONObj never is ""