What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How do I save data?????

How do I save data?????
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: How do I save data?????
quote:
Originally posted by Spunky
Although I'm sure there should be an f.Close(); before the return. This is taken from MSDN though
Indeed there should. It wouldn't be the first time some info or code on the MSDN Library is faulty. This said, at least all the complete function examples on the MSDN Library overview page in regards to reading/writing files do include the Close() statement.


------------

quote:
Originally posted by Infinity8888
this wasn't discussed in the messenger plus documentation.
Because the Messenger Plus! Scripting documentation help file (or the online docs) is about... well... Messenger Plus! stuff. It is specifically about Plus! objects, Plus! functions and Plus! events in the integrated scripting language. All the other normal things you could do in JScript are out of scope of this documentation.

So, writing to files and all kind of other stuff is pure JScript and nothing todo with Plus! specifically and thus you'll find info about that in the Windows Scripting Documentation help file (or online docs) instead.

There you'll find example code as posted by Spunky. Although, there are some small errors in Spunky's code. Below, the fixed lines in yellow:
Javascript code:
function Write(filename, text){
   try{
      var fso = new ActiveXObject("Scripting.FileSystemObject");
      var f = fso.OpenTextFile(filename, 2, true);      f.Write(text);
      f.Close();
      return 1;
   }catch(e){
      Debug.Trace("Write Error: (File '"+filename+"': " + e.message);
      return 0;
   }
}
 
function Read(filename){   try{
      var fso = new ActiveXObject("Scripting.FileSystemObject");      var f = fso.OpenTextFile(filename, 1);      var r = f.ReadLine();      f.Close();      return r;   }catch(e){
      Debug.Trace("Read Error: (File '"+filename+"': " + e.message);
      return 0; // Failed
   }
}



;)

This post was edited on 07-02-2011 at 11:20 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-02-2011 10:43 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How do I save data????? - by Infinity8888 on 07-01-2011 at 12:23 PM
RE: How do I save data????? - by matty on 07-01-2011 at 12:44 PM
RE: How do I save data????? - by Infinity8888 on 07-01-2011 at 10:56 PM
RE: How do I save data????? - by Carol6Sweet on 07-02-2011 at 01:13 PM
RE: How do I save data????? - by Infinity8888 on 07-02-2011 at 03:51 PM
RE: How do I save data????? - by MeEtc on 07-02-2011 at 05:28 PM
RE: How do I save data????? - by Spunky on 07-02-2011 at 06:11 PM
RE: How do I save data????? - by Infinity8888 on 07-02-2011 at 06:19 PM
RE: RE: How do I save data????? - by CookieRevised on 07-02-2011 at 10:43 PM
RE: How do I save data????? - by Spunky on 07-02-2011 at 06:51 PM
RE: How do I save data????? - by Infinity8888 on 07-02-2011 at 08:59 PM
RE: How do I save data????? - by Spunky on 07-02-2011 at 11:48 PM
RE: How do I save data????? - by Infinity8888 on 07-03-2011 at 05:22 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On