Packing Scripts |
Author: |
Message: |
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Packing Scripts
quote: Originally posted by pedro_cesar
Are function as feof, fget*, etc available in JavaScript?
No. Those are PHP functions and they don't exist as standard JScript functions. To access files, you'll have to use the FileSystemObject or use API calls. You can take a look at the code snippet on the MPScripts.net site and use those functions to read from or write to text files.
Note: the functions in the snippet use a variable called 'fsObj', this can be declared in global like this:
code: var fsObj = new ActiveXObject("Scripting.FileSystemObject")
but it's recommend you declare it per function to keep the memory usage low. This means, that instead of using:
code: // Reads the full contents of a text file to a variable
function ReadFile (file) {
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 1);
var contents = fileObj.ReadAll();
fileObj.Close();
return contents;
}
you use
code: // Reads the full contents of a text file to a variable
function ReadFile (file) {
var fsObj = new ActiveXObject("Scripting.FileSystemObject");
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 1);
var contents = fileObj.ReadAll();
fileObj.Close();
return contents;
}
and so on for the other functions.
This post was edited on 12-23-2006 at 02:46 PM by Matti.
|
|
12-23-2006 02:41 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: Packing Scripts
Besides that this script can be optimized extremely and that you used many things and methods which aren't needed (though, it works, so if this is your first script then ):
code: ScriptCommands += '<Name>nick1</Name>';
ScriptCommands += '<Description>Changes the nick to the number 2</Description>';
From the user's point of view this isn't logical. If he enters a command with a number (eg: 1) he expects that this command performs action 1, not action 2.
- /nick2 is an existing command from Messenger Plus!. Your script breaks this functionality. Do not do that....
In fact you don't need all those commands /nick0, /nick1, /nick2, etc if you would use parameters.
This post was edited on 12-23-2006 at 02:51 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
12-23-2006 02:48 PM |
|
|
pedro_cesar
Junior Member
Posts: 61
36 / / –
Joined: Dec 2006
Status: Away
|
O.P. RE: Packing Scripts
I saw the parameter in the Script Documentation I just didn't get it, can u give me an example?
And by the what u say about nick1 switching to to nick2, that's just a mistake, besides, all nick-related code was originally though to me, I wanted to upload the name, pm, and dp cloning part to the DB but there's one almost the same. I'm trying to modify it a bit, so hopefully I'll be accepted next time.
This post was edited on 12-23-2006 at 04:45 PM by pedro_cesar.
|
|
12-23-2006 04:41 PM |
|
|
pedro_cesar
Junior Member
Posts: 61
36 / / –
Joined: Dec 2006
Status: Away
|
O.P. RE: Packing Scripts
Wich code do u say ain't needed, I'm trying to make my script as easy as possible, I'd also like to know how can I add a contact's Display Picture (or my own) to a Display Toast??
|
|
12-31-2006 06:47 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Packing Scripts
here is the same script, but this time properly idented and with the proper methods.
All the bugs you have in the original, still remains in this one. I didn't change anything to the actual code (other than replacing /nick0, /nick1 and /nick2 because they interfear with Plus!'s /nick2 command).
The script contains a lot of things which might go wrong or things which aren't taken in account (eg: multi contact conversations, user changing the nick to something else manually, user using a parameter after commands, the backup doesn't work in all cases, etc, etc, etc).
Attachment: pedro_cesar.zip (1.23 KB)
This file has been downloaded 145 time(s).
This post was edited on 12-31-2006 at 07:41 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
12-31-2006 07:36 PM |
|
|
pedro_cesar
Junior Member
Posts: 61
36 / / –
Joined: Dec 2006
Status: Away
|
O.P. RE: Packing Scripts
I still wanna know how to add someone's Display Picture to a Display Toast.
|
|
12-31-2006 09:30 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Packing Scripts
quote: Originally posted by pedro_cesar
I still wanna know how to add someone's Display Picture to a Display Toast.
you can't...
If you want to show a toast with a display picture you're going to need to create the toast totally yourself, thus using an interface window, including the slide effect, and handling yourself where the toast should be displayed (it isn't always displayed in the bottom right corner). Furthermore, the toast will not stack upon others, etc...
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
01-01-2007 01:45 AM |
|
|
pedro_cesar
Junior Member
Posts: 61
36 / / –
Joined: Dec 2006
Status: Away
|
O.P. RE: Packing Scripts
I'll just forget about that (for now, while I'm still a noob). How can I program my msgplus to automatically send a message to a contact as soon as he logs in?
This post was edited on 01-01-2007 at 01:25 PM by pedro_cesar.
|
|
01-01-2007 01:24 PM |
|
|
rajvora
Junior Member
Posts: 59
Joined: May 2006
|
RE: Packing Scripts
quote: Originally posted by pedro_cesar
I'll just forget about that (for now, while I'm still a noob). How can I program my msgplus to automatically send a message to a contact as soon as he logs in?
This script does exactly what u want
Come Back
|
|
01-01-2007 02:42 PM |
|
|
pedro_cesar
Junior Member
Posts: 61
36 / / –
Joined: Dec 2006
Status: Away
|
O.P. Packing Scripts
I downloaded the script, I want one simpler that I can understand though, 'cuz I got nothing of that one, I basically want to know how to send a specific text automatically. I also want to know how to use the Messenger.MyStatus and the Contact.Status functions.
This post was edited on 01-09-2007 at 03:31 AM by pedro_cesar.
|
|
01-06-2007 01:43 PM |
|
|
Pages: (2):
« First
«
1
[ 2 ]
Last »
|
|