Shoutbox

Display Picture Saver - 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 Saver (/showthread.php?tid=61596)

Display Picture Saver by The Brain on 06-26-2006 at 04:37 PM

**UPDATE** Version 0.80

Sorry I haven't been around for a while. The newest version fixes various problems, including the /getall problem people have been reporting (sorry, that was my fault, should have picked that up!)

Also includes an update notifier, so you will be alerted when a new version is released (checks each time you sign in - can be turned off).

Various other minor fixes and updates, and some of the code was made more sensible (and some was probably made worse!)

Menu items for a few common commands have been added.

You can read all about it at [url]http://dhowes.blogspot.com/2006/08/dpget.html
[/url].

Also see the Scripts Database (May not be updated for a day or so)

**UPDATE** Version 0.75 (Yes, these build numbers aren't predictable....)

Biggest change here is /dpautoget. It checks your contacts every 5 minutes (can be changed) for changed disply pictures, and saves them. The system is not entirely robust, it only checks the path names of the temporarily stored DPs, to see if they are different. But in testing it seems to hold up pretty well. I imagine whenever the cache gets cleared, The DPs will be saved again as "updated", but that's what happens.

If this is turned on, it can also (optionally) add an event to the Event Viewer that the DP was changed.

I think it's new with this version too that all user preferences are saved per user in the registry. So, multiple users on the computer can save DPs to different folders, with different settings.

See the readme.txt in the Scripts folder for all the details (or access it via the command /dphelp)


**UPDATE** Version 0.51
Updated the script, with a few new commands (/dpimitate, /dpgetall) a lot more customisation for folders (give folders nick names, organise folders by username, email address, first half of email address, date) and file names (append date and time to file name).

Various commands now take email addresses as a paramter, so you can save other people's pics (they must be on your list and have a DP), not just the ones in the chat window.

eg1 /dpget user1@b.com user2@c.com user3@g.com
eg2 /dpimitate user2@blah.com

Errors are also handled a lot better now. A little taost will politely inform you if something went wrong.

I'll update this later with better instructions. And I'll submit it to the database then too.

**Original Post**


Hey all

This is my first script, and it's not really finished, but I thought I'd share it and see what you think. It is a Display Picture Saver, completely command based at the moment, although I do hope to do a GUI eventually.

The basic command is "/getdp" which will save the Display Picture of the other person in the current chat in a pre defined location. The default location is "c:\Display Pics" but this can be changed. The command is "/dpsethome <path>".

Each file name is appended with a number so that repeated calls to /getdp will save the pictures in separate files. The default file name is the contacts display name. But you can give each contact an individual nickname to be used as the file name instead. The command is "/dpsetnick <name>".

Each contacts Display Pics can also be saved in individual folders within the home directory, one folder per email address. This is off by default, but turn it on with the command "/dpemailsort" and turn it off with "/dpnoemailsort".

Finally, you can reset the count of the files with the command "/dpresetcount". This would most likely be useful if you change the directory or the a nickname, and want the cound to start at one again.

I haven't tested it at all in group conversations, so use with care. I'm really not sure what will happen, and which commands will do anything. Otherwise things should mostly work if you treat it right, but if you try and break things, you will be able to!

I have a few options I want to implement still, but give me your suggestions too. I want to improve it and make it useful.

Dallin


RE: Display Picture Saver by Voldemort on 06-26-2006 at 04:39 PM

Nice script it seems
* Voldemort is going to try it


RE: Display Picture Saver by deAd on 06-26-2006 at 04:46 PM

This can already be done in MsgPlus!...go to Contact Info (from the menu, or /ctcinfo), and select the "Save" button...


RE: RE: Display Picture Saver by The Brain on 06-26-2006 at 05:03 PM

quote:
Originally posted by deAd
This can already be done in MsgPlus!...go to Contact Info (from the menu, or /ctcinfo), and select the "Save" button...


Hmm, that's true. Hadn't seen the new contact info box. I like it! But, I like my script too. It organises DPs like I always have done it, so i'm still going to work on it and finish it. It's certainly been good practice making it, too.

Hope you like it though, Voldemort.
RE: Display Picture Saver by Michi on 06-26-2006 at 10:59 PM

Hello
I was trying to make the same script as you (that's the way I found this post), but now I found yours already made. Btw, I think that it could be a good idea giving the option to save the image with the date and time so you don't need to count, something like:
<<name-ddmmyy-hhmm.png>>
...or something like that. Maybe someone likes to see as much information as possible in the file name and maybe somebody else prefers to put a name manually each time... In my case I decided to use this:
<<email@[without"hotmail".com]yymmddhhmm>> so when I sort my images by name, they are also sorted by owner, date and time. To add this option to the script you could use something like your: "/dpsetnick <name>" with a little difference to make it recognize some parameters: "date", "time", "mail", "nick"(that can be changed with the other command), "counter"...
Then, the file name to use could be selected with that command:
"/comm_to_change_filenames mail+date+time"
or
"/comm_to_change_filenames nick+counter"
so the result in the first case is similar to what I like and in the second is totally different.
It's only an idea, I don't want to be annoying or rush you to add options :$
I was trying out your script while writing this and I couldn't make it work... Debugger gave me an error in line 80 ("file.Copy(savePath + saveFile);") so I erased that and included a part of my own code in its place:

code:
            var fecha = new Date();
            var horas = fecha.getHours();
            if (horas < 10) {horas = "0" + horas;}
            var minutos = fecha.getMinutes();
            if (minutos < 10) {minutos = "0" + minutos;}
            var segundos = fecha.getSeconds();
            if (segundos < 10) {segundos = "0" + segundos;}
            var dia = fecha.getDate();
            if (dia < 10) {dia = "0" + dia;}
            var mes = fecha.getMonth();
            if (mes < 10) {mes = "0" + mes;}
            var direccion = contact.Email;
            var nombre = "";
            for (i=0;direccion.charAt(i)!="@";i++)
            {
                nombre = nombre + direccion.charAt(i);
            }
            nombre = nombre + "@";
            file.Copy(savePath + nombre + fecha.getYear() + "-" + mes + "-" + dia + "_" + horas + "-" + minutos + "-" + segundos + ".png");

It's not too well done yet, but the script is working alright for me now. Was it only me who had the problem??? Anyway, this is what I meant before about naming files.

C U

EDIT: excuse me, I think it's clear but the light bulb is "( i )" (without spaces) and most of the variables are named in Spanish, but I hope everybody understands it... if not, feel free to ask

EDIT2: some errors fixed on the code
RE: Display Picture Saver by The Brain on 07-06-2006 at 05:33 AM

Hey thanks for the code. I had thought of implementing something like that with the date, so I will certainly borrow some of your code, if that's ok. I want to try and make it as customisable as possible, too. so including things like date reordering and date separators. 

As for the error you got - my guess would be that the contact's name, or the nickname you set, had an illegal character in it. A slash, a question mark, a star, angle brackets. something like that which aren't valid in a filename. If it wasn't that, then I'm not sure. Like I said, it should work if you treat it nicely. But it doesn't deal well with bad situations.

**UPDATE**
Implemented the date thing, and some other things. See first post for (a few more) details.

Everything is still command based for customisation. I'll add a GUI after my exams are over.

**UPDATE 2**

New Version (0..75). Details at  the top of the top post. Still no GUI. Features automatic saving of updated Display Pictures.


RE: Display Picture Saver by BunnY_ on 07-06-2006 at 11:34 AM

Dont bother... it already had this option...:)

Edit: Thanks A LOT :D


RE: Display Picture Saver by andrey on 07-15-2006 at 07:52 AM

i like this plugin a lot, but i've got one suggestion for the counter
with /dpresetcount you can set the count to 0,
but a /dpsetcount command where you can set the count to any number would be even more useful.
especially when you clean up the saved dps and there are some doubles which you want to delete and some you want to keep.


RE: Display Picture Saver by ben_b on 07-15-2006 at 08:47 AM

It'd be nice if there was a reset thing for the auto save so you could reset it and it would save all the pictures again as if they were updated. Also it would be nice if when you changed the home directory and sorting options if it would make those changes to already saved display pictures.

Edit: It'd also be pretty cool if it could save dynamic display pictures.


RE: Display Picture Saver by ben_b on 07-16-2006 at 04:25 AM

In the event log section of your script you should add a space before the ( so that in the event log it matches the spacing of the other events logged. So the end code would look like this:

code:
function autoSaveAll()
{
    if(autoGetTime == 0) {return;}
//    Debug.Trace("Auto saving...");
    regSet("DPAutoGet", 1, "REG_DWORD");
    var contacts = Messenger.MyContacts;
    var count = 0;
    var e = new Enumerator(contacts);
    for (; !e.atEnd(); e.moveNext())
    {
        var cont = e.item();
//        Debug.Trace("AS: checking " + cont.Email + " for DP updates...");

        if(regExists(cont.Email + "\\LastDP"))
        {
            if(cont.DisplayPicture != regGet(cont.Email + "\\LastDP"))
            {
//                Debug.Trace("AS: Saving updated DP from: " + cont.Email);
                if(saveDP(cont))
                {
                    count++;
                    if(addEvent)
                    {
                        MsgPlus.LogEvent(cont.Name + " (" + cont.Email + ")",
                                "Display Picture Changed (Saved)", 8);
                    }
                }
                else if(addEvent)
                {
                    MsgPlus.LogEvent(cont.Name + " (" + cont.Email +")",
                                "Display Picture Removed", 8);
                }
            }
        }
        else
        {
            if(saveDP(cont))
            {
                count++;
            }
        }
    }
   
    if(count > 0)
    {
        MsgPlus.DisplayToast("DPGet - AutoGet",
                            "DPGet has automatically saved " + count
                                + " updated Display Pictures");
    }
    MsgPlus.AddTimer("DPAutoGet", autoGetTime);
}

Also right now in the Recorded Events.xml file the first line of the event reads () but I believe this is a bug with Messenger Plus! Live because it is designed to show the name and email address there but with the MsgPlus.DisplayToast function those are not specified. I have already contacted Patchou about this issue and I'm awaiting a reply.
RE: Display Picture Saver by The Brain on 07-16-2006 at 02:08 PM

Thanks guys, appreciate the support. I've just been away for the week, but will look into adding your suggestions in the next few days.

Although some of them I won't be able to do. Eg, saving Dynamic DPs,  I have no idea how to do that. Also, resorting saved DPs would be impractical. Some things would just not be possible. Eg, if you've been saving them according to their display name, I can't keep track of which display names belong to which email addresses, if you want to re sort them. Moving files to a new home directory might be easy enough, I'll look into it.

As for saving all DPs, as if they had been updated, try the /dpgetall command, it should do what you want.


RE: Display Picture Saver by tkh7819 on 07-18-2006 at 08:34 AM

Would DPGet be able to check if the DP is already saved when auto saving?


RE: RE: Display Picture Saver by ben_b on 07-18-2006 at 09:31 AM

quote:
Originally posted by tkh7819
Would DPGet be able to check if the DP is already saved when auto saving?


Maybe if you're saving display pictures by email it could check each display picture saved for that contact and make sure it's different before saving it.
RE: RE: RE: Display Picture Saver by tkh7819 on 07-19-2006 at 02:52 AM

quote:
Originally posted by ben_b
quote:
Originally posted by tkh7819
Would DPGet be able to check if the DP is already saved when auto saving?


Maybe if you're saving display pictures by email it could check each display picture saved for that contact and make sure it's different before saving it.

I think only the few recent display pictures (like the recent two or three) is enough.
RE: Display Picture Saver by just_a_name on 08-04-2006 at 09:12 AM

This is an awesome script!!!

I had a problem almost straight away though. I tried the /dpgetall command and it reported that at least one contact didn't have a display picture, but those with were saved correctly (words to that effect). However only one photo was saved.

I then enabled /dpautoget, and it saved a whole bunch of images (about 90 sth). Brilliant... however... I decided I wanted to sort by folder, so deleted them... but am now without a way to resave the display pictures (due to the /dpgetall command not working).

Ideas?

Best script I've seen so far. Keep it up!

[edit]
idea... when the toast pops up saying 1 image has been updated, maybe clicking the text would open the image?
[/edit]


RE: RE: Display Picture Saver by ben_b on 08-04-2006 at 02:28 PM

quote:
Originally posted by just_a_name
This is an awesome script!!!

I had a problem almost straight away though. I tried the /dpgetall command and it reported that at least one contact didn't have a display picture, but those with were saved correctly (words to that effect). However only one photo was saved.

I then enabled /dpautoget, and it saved a whole bunch of images (about 90 sth). Brilliant... however... I decided I wanted to sort by folder, so deleted them... but am now without a way to resave the display pictures (due to the /dpgetall command not working).

Ideas?

Best script I've seen so far. Keep it up!

[edit]
idea... when the toast pops up saying 1 image has been updated, maybe clicking the text would open the image?
[/edit]


If you remove and readd the script and then set the options and then enable /dpautoget it should work.
RE: RE: RE: Display Picture Saver by just_a_name on 08-04-2006 at 06:40 PM

quote:
Originally posted by ben_b
If you remove and readd the script and then set the options and then enable /dpautoget it should work.


Thankyou kindly :)

Hoping the suggestion could be implemented (though what if more than 1 photo is updated? hmm).
RE: Display Picture Saver by The Brain on 08-26-2006 at 09:56 AM

Update: See first post.

to answer some queries in the thread:

  • /dpgetall should work properly now - sorry about that bug there, bad programming by me!
  • Clicking a "xx Display Pictures Saved" Toast will open up the home directory for saved DPs now. When I have some time, I might look into opening the individual folders (if using sorting options) but that is it for now. Hope it is useful.
  • Unless someone can give me a way to compare images, I won't be adding any sort of checking for previously used DPs. Sorry that they always get doubled up. It annoys me too.

Thanks for the support, hope this new version continues and improves your experience!

Dallin
RE: Display Picture Saver by Elron on 08-28-2006 at 10:36 PM

Just recently installed this script.  It looks like it has promise, but I have a rather large contact list and don't want it to save everyones display picture.  Is it possible to set it to automatically save 1 particular persons display picture for example?  If not, would this be a modification you would consider in futher updates to the script?

If it already can do this, please could you point me in the right direction to the correct commands ;)  I've read the whole readme.txt and I can't seem to see that option anywhere.  The autoget one seems to do it for all contacts does it not?


RE: Display Picture Saver by boston on 08-29-2006 at 08:12 PM

i got this but i want to change the file path to my pictures and ive tried changing the file path code but i just messed it up so give me the code i need to replace...it needs to go to my pictures
:D:D:DD:D:D:D:DD:D


RE: Display Picture Saver by The Brain on 08-30-2006 at 12:39 AM

quote:
Is it possible to set it to automatically save 1 particular persons display picture for example?  If not, would this be a modification you would consider in futher updates to the script?

No this is not a current option, but I will look into adding it for you. I am quite busy at the moment, but hopefully it'll be done by the start of next week.

quote:
i got this but i want to change the file path to my pictures and ive tried changing the file path code but i just messed it up so give me the code i need to replace...it needs to go to my pictures

From the help file:
quote:
/dpsethome path - Sets the path for the Display Pictures to be saved in. (DEFAULT: C:\Display Pics\)

So, to change the path to My Pictures you will need

/dpsethome C:\Documents and Settings\<WINDOWS USERNAME>\My Documents\My Pictures\

That should do it for you

Dallin