Shoutbox

Help! Running a file in script folder - 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: Help! Running a file in script folder (/showthread.php?tid=93924)

Help! Running a file in script folder by confa on 02-22-2010 at 06:56 PM

hi guys! I need some help with this code!

code:
...
var shell = new ActiveXObject("WScript.shell");
shell.run("C:\\Program Files\\Messenger Plus! Live\\Scripts\\ScriptFolder\\MSN.exe");
...


that path works only in Windows 7 32 bit... so I tried...

code:
...
var shell = new ActiveXObject("WScript.shell");
var MSNexe = MsgPlus.ScriptFilesPath + "\\MSN.exe"
shell.run(MSNexe);
...


but it doesn't works! why??
RE: Help! Running a file in script folder by matty on 02-22-2010 at 07:11 PM

Both should work...


RE: Help! Running a file in script folder by confa on 02-22-2010 at 07:30 PM

no, the second one give an unknown error in "shell.run(MSNexe);" maybe it's because the variable MSNexe is made by another variable (MsgPlus.ScriptFilesPath) and this line want a string of text?
that's just an idea, I'm quite new in scripting xD any suggestion is welcomed ;)


RE: Help! Running a file in script folder by pollolibredegrasa on 02-22-2010 at 07:35 PM

The path contains spaces, so you need to enclose it in quotation marks. Try the following:

jscript code:
var shell = new ActiveXObject("WScript.shell");
var MSNexe = '"' + MsgPlus.ScriptFilesPath + '\\MSN.exe"';
shell.run(MSNexe);


RE: Help! Running a file in script folder by confa on 02-22-2010 at 07:53 PM

yeah it works! thanks ;)
another thing: can I export this variable (MsgPlus.ScriptFilesPath) (or MSNexe too) to a txt or any sort of file?
i need this path to be loaded by the batch file ran before (MSN.exe) and if I simply change the script it code will not work anyway :(


RE: Help! Running a file in script folder by whiz on 02-22-2010 at 08:18 PM

js code:
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var File = FSO.CreateTextFile(MsgPlus.ScriptFilesPath + "\\Path.txt", true);
File.WriteLine(MsgPlus.ScriptFilesPath + "\\MSN.exe");
File.Close();