What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » init script in a folder

init script in a folder
Author: Message:
Suxsem
Junior Member
**


Posts: 66
Joined: Mar 2008
O.P. init script in a folder
Hi!
Look:

ScriptFolder > firstScript.js
ScriptFolder > secondScript.js

firstScript:
code:
secondScript_init()

ALL OK!
but...if i have a second script in another folder...

ScriptFolder > firstScript.js
ScriptFolder > folder > secondScript.js

firstScript:
code:
???

What is the code to initialize a script in a folder?
thank, bye!
05-06-2008 01:51 PM
Profile E-Mail PM Find Quote Report
mynetx
Skinning Contest Winner
*****

Avatar
Microsoft insider

Posts: 1175
Reputation: 33
37 / Male / Flag
Joined: Jul 2007
RE: init script in a folder
Please try to find such solutions in the Official Scripting Documentation next time, before asking. :)

Objects Reference > MsgPlus Object > MsgPlus::LoadScriptFile
quote:
Originally posted by Official Scripting Documentation
The MsgPlus::LoadScriptFile function loads additional JScript code into your running script. The whole content of the file is parsed and immediately placed in a running state (newly defined functions can be executed from anywhere in your script and lines belonging to the global scope are executed).
Syntax

    [boolean] LoadScriptFile(
        [string] ScriptFile
    );

Parameters

ScriptFile
    [string] Name of the JScript file to be loaded. It is recommended to use Unicode text files. The path is relative to the script's directory by default, to override this behavior, prefix the path with "\". Example: "\C:\directory\script.js".

Return Value

A boolean value specifying if the code was parsed and run successfully.
Remarks

The use of this function should be weighted carefully. For clarity reasons, all the files of your script should be loaded when the script is started. This function is only meant to be used if parts of your script are optional or don't require to be started immediately. Remember that all the files with a .js extension placed in your main script's directory are always automatically loaded before the script is started.

For security reasons, never use this function to run code you dynamically downloaded from the internet.
Function Information
Object     MsgPlus
Availability     Messenger Plus! Live 4.50
See Also

MsgPlus Object.
mynetx - Microsoft, enhanced.

You have a problem or issue with Windows, Internet
Explorer or Office?
Send a tweet!
05-06-2008 02:06 PM
Profile E-Mail PM Web Find Quote Report
Suxsem
Junior Member
**


Posts: 66
Joined: Mar 2008
O.P. RE: init script in a folder
scuse me...thank!
05-06-2008 02:12 PM
Profile E-Mail PM Find Quote Report
Suxsem
Junior Member
**


Posts: 66
Joined: Mar 2008
O.P. RE: init script in a folder
ok...but...
how do you Uninitialize the secondScript by firstScript?
05-06-2008 02:42 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: init script in a folder
What do you mean with uninitializing the second script?

Most of the times, there's no need to use MsgPlus.LoadScriptFile() for such simple tasks. You can make a function in the second script which starts everything it should do, and make another function which wipes out everything when it's done. Then, your first script controls when it should call those functions. It really doesn't matter if those functions are loaded on script start-up, as long as they aren't called yet.

I don't see why you'd have to start and stop the script that way, do you really have such complex things in the global scope of your second script which can't be started from a simple function? :S

(And no, you can't unload a loaded script file.)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-06-2008 04:08 PM
Profile E-Mail PM Web Find Quote Report
« 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