Shoutbox

[Question] Strange error - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Question] Strange error (/showthread.php?tid=71185)

[Question] Strange error by tryxter on 01-29-2007 at 10:08 PM

code:
function OnEvent_Initialize(MessengerStart) {
    testing();
}

function testing() {
    var Shell = new ActiveXObject("WScript.Shell");
    Shell.Run(MsgPlus.ScriptFilesPath+"\\lol.txt");
}


executing this will return me an error:

code:
Script is starting
Script is now loaded and ready
Error: unknown.
       Line: 7. Code: -2147024894.
Function OnEvent_Initialize returned an error. Code: -214735256

I think everything is ok... The files exists, the path it's fine...
What should I do?
RE: [Question] Strange error by phalanxii on 01-29-2007 at 11:48 PM

Try enclosing the path with quotation marks:

code:
function OnEvent_Initialize(MessengerStart) {
    testing();
}

function testing() {
    var Shell = new ActiveXObject("WScript.Shell");
    Shell.Run("\""+MsgPlus.ScriptFilesPath+"\\lol.txt"+"\"");
}

RE: [Question] Strange error by tryxter on 01-30-2007 at 12:09 AM

quote:
Originally posted by phalanxii
Try enclosing the path with quotation marks:
code:
function OnEvent_Initialize(MessengerStart) {
    testing();
}

function testing() {
    var Shell = new ActiveXObject("WScript.Shell");
    Shell.Run("\""+MsgPlus.ScriptFilesPath+"\\lol.txt"+"\"");
}


Worked! Great job, thanks a lot!
RE: [Question] Strange error by tryxter on 01-30-2007 at 12:02 PM

Btw, I'm getting an error while using WScript.Sleep.

code:
var Shell = WScript.CreateObject("WScript.Shell");

function OnEvent_Initialize(MessengerStart) {
    Shell.sleep(100);
}

It returns the error:

code:
Error: 'WScript' is undefined.
       Line: 1. Code: -2146823279.

Am I supposed to define WScript?
RE: [Question] Strange error by Felu on 01-30-2007 at 12:10 PM

quote:
Originally posted by tryxter
Am I supposed to define WScript?

Yes. For sleep you could also use
code:
Interop.Call("Kernel32", "Sleep", 100);

RE: [Question] Strange error by tryxter on 01-30-2007 at 12:13 PM

But I can't use WScript on msgplus scripting?

I can't do something like this in JScript?

code:
WScript.Echo("Hello World");