Announcement

Collapse
No announcement yet.

Save xButton Properties in ini file

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

  • Save xButton Properties in ini file

    Hello.

    i want to Save xButton Properties in '".ini file" and then load but after Saved and Load Script in "on Preload" have Error :

    Argument 2 must be of type table.

    Script for Save in xbutton Properties :


    Code:
    ButtonState3 = xButton.GetProperties("xButton3");
    if xButton.GetProperties("xButton3").Enabled then
    INIFile.SetValue("AutoPlay\\Docs\\ButtonState3.ini", "ButtonState3", "SetXbuttonenabled", "true");
    else
    INIFile.SetValue("AutoPlay\\Docs\\ButtonState3.ini", "ButtonState3", "SetXbuttonenabled", "false");
    end
    Script for load "on Preload":

    Code:
    SetXbuttonenabled = INIFile.GetValue("AutoPlay\\Docs\\ButtonState3.ini", "ButtonState3", "SetXbuttonenabled");
    xButton.SetProperties("xButton3", SetXbuttonenabled);

    can anybody tell me what wrong ?

  • #2
    I think that in the second script you should have something like this:
    Code:
    SetXbuttonenabled = INIFile.GetValue("AutoPlay\\Docs\\ButtonState3.ini", "ButtonState3", "SetXbuttonenabled");
    xButton.SetProperties("xButton3", {Enabled=SetXbuttonenabled});
    Because the variable SetXbuttonenabled has just this values true or false...

    Comment


    • #3
      Originally posted by claus707 View Post
      I think that in the second script you should have something like this:
      Code:
      SetXbuttonenabled = INIFile.GetValue("AutoPlay\\Docs\\ButtonState3.ini", "ButtonState3", "SetXbuttonenabled");
      xButton.SetProperties("xButton3", {Enabled=SetXbuttonenabled});
      Because the variable SetXbuttonenabled has just this values true or false...
      INIFile.GetValue returns a string value, instead the 2nd parameter of function xButton.SetProperties needs a table value.
      We are slowly invading your planet to teach lazy humans to read the user manual.
      But don't be scared: we are here to help.

      Comment


      • #4
        thank you for all!

        Comment

        Working...
        X