Shoutbox

dont show sent file - 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: dont show sent file (/showthread.php?tid=93115)

dont show sent file by SourSpud on 12-04-2009 at 01:21 AM

Is it possible for me to send a file in a conversation window without me seeing it. for example

JScript code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
  if (sMessage == '/screen') {
      oChatWnd.SendFile(MsgPlus.ScriptFilesPath+'\\Screenshot Sender 4.plsc');
      return ''
      }
  }


but i wount see it in the coversation window, or when its been received.


Cheers
RE: dont show sent file by MeEtc on 12-04-2009 at 01:24 AM

No, this is not possible to do.


RE: dont show sent file by SourSpud on 12-04-2009 at 01:28 AM

Are you sure? are you a scripter?


RE: dont show sent file by MeEtc on 12-04-2009 at 01:42 AM

Yes I am a scripter. Yes I'm sure its not possible to not show a file being sent.


RE: dont show sent file by SourSpud on 12-04-2009 at 01:49 AM

but it is possible to hide the chat window? so once the file is sent it will close the chat window and automatically reopen it.


RE: dont show sent file by matty on 12-04-2009 at 02:06 AM

quote:
Originally posted by SourSpud
but it is possible to hide the chat window? so once the file is sent it will close the chat window and automatically reopen it.
There isn't any events that are triggered when a file is sent or finished sending.
RE: dont show sent file by SourSpud on 12-04-2009 at 02:30 AM

is it possible to do what i said but instead of waitin for the file to send it closes the chat window after 1 minute and re opens it.


RE: dont show sent file by Spunky on 12-04-2009 at 02:32 AM

No. ChatWnds must remain open whilst sending the file...


RE: dont show sent file by SourSpud on 12-04-2009 at 02:56 AM

How come you can't search for 'Transfer of "Screenshot Sender 4.plsc" is complete.' in the chat window? :(


RE: dont show sent file by NanaFreak on 12-04-2009 at 04:25 AM

because you cant. just let it go... it cant be done


RE: dont show sent file by matty on 12-04-2009 at 04:28 AM

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".


RE: dont show sent file by SourSpud on 12-04-2009 at 05:40 AM

matty could you be the first to attempt it :P


RE: dont show sent file by matty on 12-04-2009 at 06:12 AM

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 );


RE: dont show sent file by SourSpud on 12-04-2009 at 06:18 AM

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


RE: dont show sent file by matty on 12-04-2009 at 06:27 AM

Its not something I am going to work on any time soon. Someone else can continue on from there.


RE: dont show sent file by CookieRevised on 12-04-2009 at 12:35 PM

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.