Syntax Error || Help? ||
-
Any ideas? Getting "7:13 Syntax Error"
if (presetFile.isFile()) { ArpNotesPresets = presetFile.loadAsObject(); // "7:13 Syntax Error" // Manually extract keys var keyList = []; for (k in ArpNotesPresets) keyList.push(k); ArpPresetList.set("items", keyList.join("\n")); }
-
C Chazrox marked this topic as a question
-
@Chazrox does your preset file contain valid json data?
-
@d-healey it writes to it and populates the combobox so I assume its declared properly.
but...ArpNotesPresetsA doesnt show up like the other files...clue?
**EDIT File icon is the same now.
Upon recompiling thats when I get the Errror.
Its lets me save as many items until I recompile then I get Syntax Errror.
-
@d-healey I fixed it....
// I had this.... const var ArpNotesPresets = {}; // Should've been this.... reg ArpNotesPresets = {}; // Lesson learned
**EDIT See Below....
-
C Chazrox has marked this topic as solved
-
Im still having a problem with Syntax error. Im not changing the object but when I start testing if its writing values, after recompiling or saving a preset, it show 'Syntax Error'.
Can you spot it?
namespace ArpeggiatorPresetsSubMenu { //---------------------------COMPONENT DECLARATIONS-------------------------- // COMBOBOX const var ArpPresetList = Content.getComponent("ArpPresetList"); // LABEL TEXT INPUT const var ArpPresetNameToSave = Content.getComponent("ArpPresetNameToSave"); // SAVE OK BUTTON const var ArpSaveOk = Content.getComponent("ArpSaveOk"); // SAVE OK BUTTON //--------------------------FILE & OBJECT DECLARATION ------------------------ // File path for saving/loading const var presetFile = FileSystem.getFolder(FileSystem.Desktop).getChildFile("ArpNotesPresetsA.json"); // Declare object to hold presets reg ArpNotesPresets = {}; //------------------------POPULATE COMBOBOX -------------------------------- if (presetFile.isFile()) { ArpNotesPresets = presetFile.loadAsObject(); // Manually extract keys var keyList = []; for (k in ArpNotesPresets) keyList.push(k); ArpPresetList.set("items", keyList.join("\n")); } //------------------------ SAVE PRESET --------------------------------------- inline function onArpSaveOkControl(component, value) { if (!value) return; local ArpPresetNameNOW = ArpPresetNameToSave.get("text").trim(); // If no text entered, use current selected name if (ArpPresetNameNOW == "") { local selectedIndex = ArpPresetList.getValue(); if (selectedIndex <= 0) return; ArpPresetNameNOW = ArpPresetList.getItemText(); // Use selected preset name } local TempoNOW = knbArpSpeed.getValue(); local NumStepsNOW = knbNumSliders.getValue(); local SwingNOW = knbArpShuffle.getValue(); local OctaveNOW = knbOctaveRange.getValue(); local NumSliders = knbNumSliders.getValue(); ArpNotesPresets.Tempo = TempoNOW; ArpNotesPresets.NumSteps = NumStepsNOW; ArpNotesPresets.Swing = SwingNOW; ArpNotesPresets.Octave = OctaveNOW; // Save to file presetFile.writeObject(ArpNotesPresets); // Update ComboBox local keyList = []; for (k in ArpNotesPresets) keyList.push(k); ArpPresetList.set("items", keyList.join("\n")); ArpPresetList.setValue(keyList.indexOf(ArpPresetNameNOW) + 1); ArpPresetNameToSave.set("text", ""); }; ArpSaveOk.setControlCallback(onArpSaveOkControl); //------------------ COMBOBOX PRESETS CONTROLS -------------------------------- }
-
@Chazrox Leave us alone, we're learning alot tonight.
-
@Chazrox open the file in a text editor, make sure it contains what you expect
-
@d-healey I got this working. I just need that loop. haha.