What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » A newbie question

Pages: (2): « First [ 1 ] 2 » Last »
A newbie question
Author: Message:
chrisb
New Member
*


Posts: 13
Joined: Sep 2009
O.P. A newbie question
I have a question regarding the ability to read text files, I have a text file however I am getting the error

code:
Function called: OnEvent_MyStatusChange
Error: Bad file name or number (code: -2146828236)
       File: my.js. Line: 11.
Function OnEvent_MyStatusChange returned an error. Code: -2147352567

And the code I am using is

code:
function OnEvent_MyStatusChange()    {
Messenger.MyPersonalMessage = new ActiveXObject  ( 'Scripting.FileSystemObject' ).OpenTextFile ( 'http://buttonbashers.co.uk/test.txt' , 1 ).ReadAll ( );
}
09-03-2009 10:58 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: A newbie question
FileSystemObject can only read local files. Therefore you have 2 options. Firstly you can use URLDownloadToFile to download the text file and then you can read it locally. Second option is to use ajax, an example can be found here -dt-'s reply to Tips.
09-03-2009 12:19 PM
Profile E-Mail PM Find Quote Report
chrisb
New Member
*


Posts: 13
Joined: Sep 2009
O.P. RE: A newbie question
i went for the AJAX option, thanks! I also wanted to know, how do I create the option windows such as for setting variables?
09-03-2009 02:43 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: A newbie question
Take a look at the scripting document. It provides examples. They are made in XML.
09-03-2009 03:00 PM
Profile E-Mail PM Find Quote Report
chrisb
New Member
*


Posts: 13
Joined: Sep 2009
O.P. RE: A newbie question
Okay i have found that now, one last question. How can I store information such as a perticular variable so that it is remembered for next time. I can't seem to find it in the documentation.
09-03-2009 03:28 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: A newbie question
There isn't a defined way. The developer can decide how they want to do that. Could be any of the following and then some:
  • INI File
  • XML File
  • Registry
  • Database

That is all up to you as the developer.
09-03-2009 03:32 PM
Profile E-Mail PM Find Quote Report
chrisb
New Member
*


Posts: 13
Joined: Sep 2009
O.P. RE: A newbie question
Oh wow, such choice :P, I will take a look in the jScript documentation for that. Thanks a bunch matty, you have been a big help!
09-03-2009 03:34 PM
Profile E-Mail PM Find Quote Report
chrisb
New Member
*


Posts: 13
Joined: Sep 2009
O.P. RE: A newbie question
Could you just tell me what the following should be, I know I have done it wrong...

var ctrlTxt = MsgPlus.GetControlText("txtEl");
09-03-2009 03:45 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: A newbie question
quote:
Originally posted by chrisb
Oh wow, such choice :P, I will take a look in the jScript documentation for that. Thanks a bunch matty, you have been a big help!
The JScript documentation won't give you all the information you need.
I attached a registry script I wrote for easy access to the registry.
A database is just too much work for a script and not worth the effort. This leaves you with XML and INI files.
INI files use the following functions:
GetPrivateProfileString
WritePrivateProfileString
GetPrivateProfileInt

As for XML there is lots of information out on the internet about it.

quote:
Originally posted by chrisb
Could you just tell me what the following should be, I know I have done it wrong...

var ctrlTxt = MsgPlus.GetControlText("txtEl");
GetControlText is a function of the Plus! Window. Therefore when you open the window you need to assign it to a variable for later use.

The following is simply an example and shouldn't be used for larger scripts with multiple windows
Javascript code:
var pPlusWnd;
pPlusWnd = MsgPlus.OpenWindow ( '...' , '...' );
Debug.Trace ( pPlusWnd.GetControlText ( 'myControl' ) );


.zip File Attachment: registry.zip (2.45 KB)
This file has been downloaded 107 time(s).

This post was edited on 09-03-2009 at 03:56 PM by matty.
09-03-2009 03:48 PM
Profile E-Mail PM Find Quote Report
chrisb
New Member
*


Posts: 13
Joined: Sep 2009
O.P. RE: A newbie question
Thanks, that worked :)
09-03-2009 03:50 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