What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Display Picture Problem.

Display Picture Problem.
Author: Message:
neohunter
Junior Member
**


Posts: 38
Joined: Aug 2006
O.P. Display Picture Problem.
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

08-31-2006 10:35 PM
Profile E-Mail PM Find Quote Report
neohunter
Junior Member
**


Posts: 38
Joined: Aug 2006
O.P. RE: Display Picture Problem.
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!
09-01-2006 01:20 AM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Display Picture Problem.
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);
09-01-2006 01:23 AM
Profile PM Find Quote Report
neohunter
Junior Member
**


Posts: 38
Joined: Aug 2006
O.P. RE: Display Picture Problem.
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.
09-01-2006 01:33 AM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Display Picture Problem.
Try:
code:
shell.run(MsgPlus.ScriptFilesPath + "\\wget.exe 'http://dominio.com/pic.jpg'", 0, true);
09-01-2006 02:48 AM
Profile PM Find Quote Report
neohunter
Junior Member
**


Posts: 38
Joined: Aug 2006
O.P. RE: Display Picture Problem.
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!
09-01-2006 06:27 AM
Profile E-Mail PM Find Quote Report
neohunter
Junior Member
**


Posts: 38
Joined: Aug 2006
O.P. RE: Display Picture Problem.
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]
09-01-2006 07:07 AM
Profile E-Mail PM 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