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

Pages: (2): « First [ 1 ] 2 » Last »
How do I save data?????
Author: Message:
Infinity8888
New Member
*


Posts: 6
Joined: Jul 2011
O.P. How do I save data?????
Hello Everyone

I've been wanting to develop a script of my own for over 6 months now but I found it very hard to save data on the hard drive. In fact, I still don't know how it works. I know it has to do with XML and ActiveX but I never used both these languages.

So basically, my question is : what is the simplest way to save something on the hard drive??? I spend my whole afternoon yesterday and today's whole morning trying to figure out how it worked, but it seems hard and complicated. Is there simply a function that does the work?

Also, I suck at JScript

Please reply, thank you
07-01-2011 12:23 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: How do I save data?????
What exactly are you trying to save?
07-01-2011 12:44 PM
Profile E-Mail PM Find Quote Report
Infinity8888
New Member
*


Posts: 6
Joined: Jul 2011
O.P. RE: How do I save data?????
I wanna make a script that counts how many times I spoke to a contact. I need to save that number every time I close the chat window let's say
07-01-2011 10:56 PM
Profile E-Mail PM Find Quote Report
Carol6Sweet
New Member
*


Posts: 1
42 / Female / –
Joined: Jul 2011
RE: How do I save data?????
I am interested in knowing the code so if you get it from anywhere please share.
07-02-2011 01:13 PM
Profile E-Mail PM Find Quote Report
Infinity8888
New Member
*


Posts: 6
Joined: Jul 2011
O.P. RE: How do I save data?????
There's no code for the moment. I programmed my app on MatLab, and generated an exe file. But it sucks to have to write the name of the person everytime, so that's why I wanna do it as a messenger script.
The problem is I don't know how to save the data
07-02-2011 03:51 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: How do I save data?????
There are 2 ways that you can do this, you can save data to a file or to the Windows registry. Take a look on the scripts forum and other scripts
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
07-02-2011 05:28 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: How do I save data?????
quote:
Originally posted by Infinity8888
I wanna make a script that counts how many times I spoke to a contact. I need to save that number every time I close the chat window let's say

How many messages or how many times a window was opened?
<Eljay> "Problems encountered: shit blew up" :zippy:
07-02-2011 06:11 PM
Profile PM Find Quote Report
Infinity8888
New Member
*


Posts: 6
Joined: Jul 2011
O.P. RE: How do I save data?????
How many times a window was opened for example. The algorithm is simple - as I said I've already done it all in Matlab - I just don't know how to save data with jscript, and this wasn't discussed in the messenger plus documentation. Is it just a simple instruction?

I've checked out another script (called Stat Center) and it was really confusing, there were notions of encoder, decoder, serializer, asyncrhonous, I was like "wtf???"
07-02-2011 06:19 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: How do I save data?????
The best analogue I can think of to learn from would be a win32 read/write example. Some things need to be changed though still such as ActiveXObject instead of create object and no constants are defined so you have to explicitly assign these values. There may be an example somewhere around here. I'll see what I can dig up (getting son to sleep atm)


Javascript code:
function WriteDemo()
{
   var fso, f, r
   var ForReading = 1, ForWriting = 2;
   fso = new ActiveXObject("Scripting.FileSystemObject")
   f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true)
   f.Write("Hello world!");
   f.Close();
   f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
   r = f.ReadLine();
   return(r);
}


Hopefully you can use bits of that for what you want; it's all there


Although I'm sure there should be an f.Close(); before the return. This is taken from MSDN though


It can be put into two functions:

Javascript code:
function Write(filename, text){
   try{
      var fso = new ActiveXObject("Scripting.FileSystemObject")
      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{
      f = fso.OpenTextFile(filename, 1);
      return f.ReadLine();
   }catch(e){
      Debug.Trace("Read Error: (File '"+filename+"': " + e.message);
      return 0; // Failed
   }
}


This post was edited on 07-02-2011 at 08:17 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
07-02-2011 06:51 PM
Profile PM Find Quote Report
Infinity8888
New Member
*


Posts: 6
Joined: Jul 2011
O.P. RE: How do I save data?????
Oh thanx this is working. I've read about XML but if I can use this to write in txt files, it doesn't bother me

Thank you very much
07-02-2011 08:59 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


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