quote:
Originally posted by matty
There is a way of doing it but no one has ever attempted to do it before.
publically
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.