Shoutbox

Download a File - 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: Download a File (/showthread.php?tid=91118)

Download a File by leetking on 06-19-2009 at 11:12 PM

Hello guys,
just wanted to know if there is any way to download a file on the PC with a MSN Script?


RE: Download a File by ryxdp on 06-19-2009 at 11:50 PM

quote:
Originally posted by leetking
Hello guys,
just wanted to know if there is any way to download a file on the PC with a MSN Script?

Yes there is, you can use the MsgPlus.DownloadFile() function. See the Scripting Documentation for more information :)
RE: RE: Download a File by leetking on 06-20-2009 at 12:50 PM

code:
function OnEvent_DownloadFileComplete(Url, OutFile, Success){
    Debug.Trace("Url: " + Url);
    Debug.Trace("OutFile: " + OutFile);
    Debug.Trace("Success: " + Success);
    }

var Url = "http://www.msgpluslive.net/favicon.ico";
MsgPlus.DownloadFile(Url);

This works.

code:
Skript wurde angehalten
Skript wird gestartet
Skript wurde geladen und ist bereit
Aufgerufene Funktion: OnEvent_DownloadFileComplete
Url: http://www.msgpluslive.net/favicon.ico
OutFile: C:\DOKUME~1\Manuel\LOKALE~1\Temp\mpscript_343b.tmp
Success: true


But:
code:
var Url = "http://www.msgpluslive.net/favicon.ico";
var OutFile = "C:\\ ";
MsgPlus.DownloadFile(Url, OutFile);

doesnt work:
code:
Skript wird gestartet
Skript wurde geladen und ist bereit
Aufgerufene Funktion: OnEvent_DownloadFileComplete
Url: http://www.msgpluslive.net/favicon.ico
OutFile: C:\
Success: false

RE: Download a File by Matti on 06-20-2009 at 12:55 PM

That's because "OutFile" has to be a file path, not only a folder path. So you should change that to something like:

js code:
var Url = "http://www.msgpluslive.net/favicon.ico";
var OutFile = "C:\\favicon.ico";
MsgPlus.DownloadFile(Url, OutFile);

RE: RE: Download a File by leetking on 06-20-2009 at 01:01 PM

quote:
Originally posted by Matti
That's because "OutFile" has to be a file path, not only a folder path. So you should change that to something like:
js code:
var Url = "http://www.msgpluslive.net/favicon.ico";
var OutFile = "C:\\favicon.ico";
MsgPlus.DownloadFile(Url, OutFile);



Woot :) thx. It works now!
New Question: Is there a way to find out a path, for example, to the MSN Script ? So it will automatically update itself?
RE: Download a File by NanaFreak on 06-20-2009 at 01:11 PM

MsgPlus.ScriptFilesPath

and if you want to make a script auto-update, Messenger Plus! Live can do this if you submit it to the database... I forget where this information is, but if you search the forums or the main website you should be able to find this ;)

edit: shush you Matti 8-)


RE: Download a File by Matti on 06-20-2009 at 01:18 PM

quote:
Originally posted by NanaFreak
I forget where this information is, but if you search the forums or the main website you should be able to find this ;)
It's right here: Auto-Update for Skins & Scripts FAQ (stickied under MsgPlus! General Talk)