Display Picture Problem. - 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: Display Picture Problem. (/showthread.php?tid=65668)
Display Picture Problem. by neohunter on 08-31-2006 at 10:35 PM
Hi!! im just starting making Messenger Plus scripts!
i writing a script for a online game. The user write they username/password on msn and he gets they account info. Thats works perfect! im using:
new ActiveXObject("Microsoft.XMLHTTP");
and send the vars using POST. Next the server reply with an XML and woala! =)
but now i want to replace the display picture of the user for a dinamic generatic PIC using PhpGD Library in the server. I have the pic already.
So Lets suposse the pic is in:
www.domain.com/pic.jpg
So i need to download it and save to the client HardDisk.
i read about the ActiveXObject("Scripting.FileSystemObject"); but just allow me write ASCII files.
So i just dont know how to download and how to write to the HD.
please help =) and please sorry my english, =P
RE: Display Picture Problem. by neohunter on 09-01-2006 at 01:20 AM
Ok i have a idea 10 minutos ago, i compile wget in cygwin and include on my package. So next try use de wscript.shell activex Obj
var shell = new ActiveXObject("wscript.shell");
shell.run("wget.exe http://dominio.com/pic.jpg", 0, true);
but it try to load the wget file from the c:\windows dir!! arggg!! there is any variable containing the current dir!!?!?! or there is anyway to copy the wget.exe to the windows dir? please anybody help me!! this is frustranting!
RE: Display Picture Problem. by deAd on 09-01-2006 at 01:23 AM
the current dir is stored in the variable "MsgPlus.ScriptFilesPath", so you'd want to use:
code: shell.run(MsgPlus.ScriptFilesPath + "\\wget.exe http://dominio.com/pic.jpg", 0, true);
RE: Display Picture Problem. by neohunter on 09-01-2006 at 01:33 AM
Returns me a Unknow Error...
mmm lets se. The wget.exe is on the script folder
1. i run from the cmd wget.exe http://dominio.com/pic.jpg
Works fine.
2. i do in JS:
shell.run(wget.exe http://dominio.com/pic.jpg", 0, true);
Returns me an unknow error.
3. I try coping the wget file to the c:\windows dir and in js:
shell.run(wget.exe http://dominio.com/pic.jpg", 0, true);
Dont return me an unknow error. But i dont see any downloaded file...
4. i do in js your idea. returnme an unkown error...
any idea of how to download a image from internet and save on the HD?
shell.run(wget.exe http://dominio.com/pic.jpg", 0, true);
works.
RE: Display Picture Problem. by deAd on 09-01-2006 at 02:48 AM
Try:
code: shell.run(MsgPlus.ScriptFilesPath + "\\wget.exe 'http://dominio.com/pic.jpg'", 0, true);
RE: Display Picture Problem. by neohunter on 09-01-2006 at 06:27 AM
The same. Return me a unknow error...
also i put everything on a .BAT file, but returns me a unknow error:
var shell = new ActiveXObject("wscript.shell");
shell.run(MsgPlus.ScriptFilesPath + "\\dp.bat", 0, false);
.... a couple of minuter later...
I found something! you remember that i said that the script dont give me an error but dont download anything! well, wget download the image to c:\program file\msn messenger\ y try using the -O command of wget but doesnt work:
shell.run("wget.exe http://vglife.com/perro.jpg -O C:\\dp.jpg", 0, false);
im close to do it!
RE: Display Picture Problem. by neohunter on 09-01-2006 at 07:07 AM
VICTORY!!
this is the code... if anyone want to use it just tell me i dont have any problem
[QUOTE]
var update = Math.round(300*Math.random());
client = new ActiveXObject("Microsoft.XMLHTTP");
//MsgPlus.DisplayToast("UnionRo","Conectandose");
client.open("POST","http://vglife.com/plusplugin.php?update=" + update,true);
client.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
client.send('login=' + email + '&pass=' + password);
client.onreadystatechange = function(){
if(client.readyState==4){
Messenger.MyName = ParseData(client.responseText,"nick");
Messenger.MyPersonalMessage = ParseData(client.responseText,"subnick");
//Display Picture
dpurl = ParseData(client.responseText,"dpurl");
var shell = new ActiveXObject("wscript.shell");
shell.run('wget.exe '+dpurl+' -O C:\\dp.jpg', 0, false);
}
}
Messenger.MyDisplayPicture = 'C:\\dp.jpg';
[/QUOTE]
|