What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » dont show sent file

Pages: (2): « First « 1 [ 2 ] Last »
dont show sent file
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: dont show sent file
There is a way of doing it but no one has ever attempted to do it before.

It involves using Active Accessibility to get the length of characters in the history then using the oChatWnd.HistoryText_GetTextRange(0, len, false) and check that for "Transfer of blah blah blah".
12-04-2009 04:28 AM
Profile E-Mail PM Find Quote Report
SourSpud
Junior Member
**

Avatar
spud, spud, spud, spoon.

Posts: 58
35 / Male / Flag
Joined: Nov 2009
O.P. RE: dont show sent file
matty could you be the first to attempt it :P
12-04-2009 05:40 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: dont show sent file
I attempted it and made it pretty far but I gave up as I didn't have the time.

This is how you would get the iAccessible interface

Javascript code:
hWnd = Interop.Call('user32', 'FindWindowExW', oChatWnd.Handle, 0, 'DirectUIHWND', '');
 
var IID_IAccessible = Interop.Allocate(16);
with (IID_IAccessible) { WriteDWORD(0, 0x618736E0); WriteWORD(4, 0x3C3D); WriteWORD(6, 0x11CF); SetAt(8, 0x81); SetAt(9, 0xc); SetAt(10, 0x0); SetAt(11, 0xaa); SetAt(12, 0x0); SetAt(13, 0x38); SetAt(14, 0x9b); SetAt(15, 0x71); }
 
var pAccessible = Interop.Allocate(4);
 
Interop.Call('oleacc', 'AccessibleObjectFromWindow', hWnd, 0xFFFFFFFC /* OBJID_CLIENT */, IID_IAccessible, pAccessible);
 
var iAccessible = pAccessible.ReadInterfacePtr( 0 );


This post was edited on 12-04-2009 at 06:12 AM by matty.
12-04-2009 06:12 AM
Profile E-Mail PM Find Quote Report
SourSpud
Junior Member
**

Avatar
spud, spud, spud, spoon.

Posts: 58
35 / Male / Flag
Joined: Nov 2009
O.P. RE: dont show sent file
I'm not sure how to use that, maybe try and complete it when you have time. I have work now, and have to get ready :( will be back in about 14 hours (Y) hope you can manage it

cheers mate
12-04-2009 06:18 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: dont show sent file
Its not something I am going to work on any time soon. Someone else can continue on from there.
12-04-2009 06:27 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: dont show sent file
quote:
Originally posted by matty
There is a way of doing it but no one has ever attempted to do it before.
publically :p
But conclussion is that it wont work properly and is very complex. Read below ;)

quote:
Originally posted by matty
It involves using Active Accessibility to get the length of characters in the history then using the oChatWnd.HistoryText_GetTextRange(0, len, false) and check that for "Transfer of blah blah blah".
You don't need the Active Accessibility API for that.

You can enter a big number for the length portion of oChatWnd.HistoryText_GetTextRange(). The length parameter can be bigger than the actual number of characters in the history. The returned string will simply be truncated to contain all the characters. So, you could use oChatWnd.HistoryText_GetTextRange() and get the length of that returned string.

I would also suggest to set the AddObjectCodes to true instead of false though. This, so you can better check for point 2 below.

There are a few caveats though:

1) When a file transfer is cancelled or finished, there is no event which will trigger. So you need to constantly poll the history to check for the "transfer of blahblah" string.

2) The message "transfer of blahblah" can be spoofed by the contact. To catch this, you must also use the OnEvent_ChatWndReceiveMessage function to check if the message isn't written by the contact itself.

3) The "transfer of blahblah" string is obviously language dependant. So, to check for the proper string you first must get the proper translation in the language resource file of Messenger. Which involves getting the proper DLL name (which can/will change from version to version). And because those strings contain placeholders and because those placeholders can occur anywhere in the string depending on the language, you need to replace them with the proper substrings, which involves getting the exact name of the file and the contact, etc... etc... etc... Can partially be solved by using regular expressions, but that on its turn has some caveats, etc...

4) There is more than one string you must check upon because a file transfer can fail, can be successfull, but it is also possible that file transfer isn't possible with the contact, etc. See all the strings in the language resource of Messenger related to file transfers: 2100, 2101, 2103, 2105, 2111, etc... There are roughly 60 different messages!!!

5) All this requires that you start a polling function using a timer once you initiate a file transfer. This also means that the transfer of files must be done programatically and not manually (by copy/pasting). It also means that once you are in a file transfer you may not use copy/pasting to send a file, otherwise the function will not work properly. To make things even more complicated, multiple file transfers do not always end in the same sequence that you started them.

And then there is also the fact that there is nothing to check upon (no action message) when you cancel the transfer or when you or your contact changes status to appear offline, etc.

etc...a whole lot other caveats...etc



so:
quote:
Originally posted by SourSpud
How come you can't search for 'Transfer of "Screenshot Sender 4.plsc" is complete.' in the chat window? :(
you can, but it isn't as simple as that. To handle it properly you need an extremely complex script and it would always have limitations like described in point 5 above.

Since you're a beginning scripter I would say forget about it. Even for advanced scripters this is very hard to make properly and it depends on way too many things, things which you didn't specify. It is as good as impossible to make 'a' function for you and simply copy/paste it into your script, it needs to be well integrated in an existing script and as soon as you change or add something the whole procedure might have to be changed.

To add to all this, Plus! makes it possible to manipulate the history text (make some text smaller) and Messenger itself also does this if it, for example, displays and hides the "Cancel" link when a transfer starts. This should be taken in account too.

-------------

Believe me, I tried all the above some time ago; and just dusted off my old attempts again, but I came to the same conclussions. it is very hard to make something decent using this method.

This post was edited on 12-05-2009 at 07:29 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-04-2009 12:35 PM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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