Shoutbox

best way to store/save information? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: best way to store/save information? (/showthread.php?tid=61612)

best way to store/save information? by JonnyT on 06-26-2006 at 06:00 PM

What would be the best method, and how dyou do it, to store/save information for scripts. Things like settings/options, nicknames etc

Thanks J


RE: best way to store/save information? by Griffo on 06-26-2006 at 08:26 PM

Good question! I would also be interested.


RE: best way to store/save information? by J-Thread on 06-26-2006 at 08:38 PM

The registry, definatly. Take a look at the documentation for an example howto do it;)


RE: best way to store/save information? by segosa on 06-26-2006 at 08:39 PM

Look at the documentation for MsgPlus.ScriptRegPath.


RE: best way to store/save information? by CookieRevised on 07-02-2006 at 01:49 AM

quote:
Originally posted by JonnyT
What would be the best method, and how dyou do it, to store/save information for scripts. Things like settings/options, nicknames etc

Thanks J
There would be no 'best' method. It highly depends on what those settings actually are.

There are some methods you can use:
1) Saving data in not structured files
2) Saving data in INI files
3) Saving data in XML files
4) Saving data in the registry

For each there are benefits and drawbacks, and each can/should be used for specific scenarios. Which method you choose depends on many things, but in the first place the kind of data to be stored. eg:

1) Saving binary data or data which contains huge lumps of text, etc. Easly portable and easy to backup. Not easy to code, unless 1 file contains only 1 dataset.
2) Saving small settings which don't need complex structures. Easly portable and easy to backup. Can be reconized easly, read in an instant and edited by everyone. Difficult to work with in scripts as it doesn't support an INI structure by default.
3) Saving more complex data structures. Easly portable and easy to backup. Not so easy to see the actual settings at first glance as it contains lots of "special codes". Needs some amount of support code in your script.
4) Saving small settings or not so complex data structures. No files needed and thus not easly porteable. Not everybody knows how to manually edit it, etc. Though requires the least amuont of code in scripts.

Mostly you'll see that the registry is being used as that is the most ideal in many scripts.
RE: best way to store/save information? by Griffo on 07-15-2006 at 03:43 PM

Okay, couple of thngs,

How would you save a setting from a window to the registry. Say you have an EditControl and the defualt text was "hello" and then you changed it to "hello world". How would you save the new data to the registry? I know the procedure to use from the help file, but not in the correct way I need.

Also, how would I do the same for opening a window if I wanted to load my settings. Say the EditControl ID is "ECLocation", how would I read this from the registry, so when I fire my open window procedure it plonks the loaded data into the window ready?

My current open window procedure is...

code:
function OnEvent_MenuClicked(mnuPref)
{
    var Wnd = MsgPlus.CreateWnd("Preferences.xml", "WndPref");
}

Phew - thanks in advance! :)
RE: best way to store/save information? by Volv on 07-15-2006 at 03:53 PM

PlusWnd.GetControlText to get the text from the EditControl & PlusWnd.SetControlText to set the text of the EditControl.


RE: best way to store/save information? by Griffo on 07-15-2006 at 04:03 PM

Thanks - will give those a go :)