Shoutbox

[HELP] Store variable - 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: [HELP] Store variable (/showthread.php?tid=89545)

[HELP] Store variable by hajani on 03-08-2009 at 04:08 PM

How can i store a variable somewhere? (i set for example myvar to "3" by function, and on next start value of myvar is "3")


RE: [HELP] Store variable by matty on 03-08-2009 at 04:29 PM

You can use the registry, an XML file, an INI file... take your pick...


RE: [HELP] Store variable by hajani on 03-08-2009 at 04:33 PM

can i do this with javascript (msn plus script) or i must do it with vb?


RE: [HELP] Store variable by matty on 03-08-2009 at 04:41 PM

No you can do it with JScript. Have you decided where you want to store it?


RE: [HELP] Store variable by hajani on 03-08-2009 at 04:49 PM

a single txt file would be excellent, but how can i write a file with javascript?
thanks in advance


RE: [HELP] Store variable by Matti on 03-08-2009 at 05:13 PM

  • Registry
    Interesting for: local preferences
    Application: use the Windows Script Host Shell object.
    js code:
    var oWshShell = new ActiveXObject("WScript.Shell");
    //Write to a key value
    oWshShell.RegWrite(MsgPlus.ScriptRegPath + "myvar", 3, "REG_DWORD");
    //Read a key value
    var myvar = oWshShell.RegRead(MsgPlus.ScriptRegPath + "myvar");
    Alternatively, you can use the original Win32 functions to do this, but this requires more advanced coding. You could also look at other scripts for registry functions, such as my own Countdown Live in "Registry.js".
  • XML
    Interesting for: portable preferences
    Application: use the XMLDOM.
  • Text file
    Application: use the FileSystemObject or the Win32 ReadFile function.
  • INI file
    Interesting for: language files and preferences
    Application: use the FileSystemObject to read the file and parse it afterwards, or use GetPrivateProfileString if you're not going to make many calls.
For more information about the usage, try to search the forums! Many methods have already been covered here. ;)
RE: [HELP] Store variable by hajani on 03-08-2009 at 05:58 PM

thank you very much :)


RE: [HELP] Store variable by matty on 03-08-2009 at 06:14 PM

quote:
Originally posted by Matti
such as my own Countdown Live in "Registry.js".
Wasn't that based off of Screenshot Sender :P
RE: [HELP] Store variable by Matti on 03-08-2009 at 07:22 PM

quote:
Originally posted by matty
quote:
Originally posted by Matti
such as my own Countdown Live in "Registry.js".
Wasn't that based off of Screenshot Sender :P
Yes it is, but your Screenshot Sender 5 is yet to be released! :P