What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Active Accessibility Objects and ReadInterfacePtr

Active Accessibility Objects and ReadInterfacePtr
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: Active Accessibility Objects and ReadInterfacePtr
This works thanks to Patchy!

js code:
if (Messenger.MyStatus === STATUS_UNKNOWN) {
   
    Debug.DebuggingWindowVisible = true;
    Debug.ClearDebuggingWindow();
   
    var hWnd = Interop.Call('user32', 'FindWindowExW', Messenger.ContactListWndHandle, 0, 'Main Window Class', '');
    hWnd = Interop.Call('user32', 'FindWindowExW', hWnd, 0, 'DirectUIHWND', '');
     
    var IID_IAccessible = Interop.Allocate(16);
    Interop.Call('ole32', 'IIDFromString', '{618736E0-3C3D-11CF-810C-00AA00389B71}', IID_IAccessible);
     
    var pAccessibleData = Interop.Allocate(4);
    if(Interop.Call('oleacc', 'AccessibleObjectFromWindow', hWnd, 0xFFFFFFFC, IID_IAccessible, pAccessibleData) === 0) {
        var iAccessible = pAccessibleData.ReadInterfacePtr(0);
        if(iAccessible) {
            var iAccessibleChildren = Interop.Allocate(16*iAccessible.accChildCount);
            var iAccessibleChildrenFound = Interop.Allocate(4);
            if (Interop.Call('oleacc', 'AccessibleChildren', iAccessible, 0, iAccessible.accChildCount, iAccessibleChildren, iAccessibleChildrenFound) === 0){
            Debug.Trace('Child Count: '+iAccessibleChildrenFound.ReadDWORD(0));
                for (var i=0; i<iAccessibleChildrenFound.ReadDWORD(0); ++i) {
                    if (iAccessibleChildren.ReadDWORD(i*16) === 0x9) {
                        var iAccessibleChild = iAccessibleChildren.ReadInterfacePtr(i*16+8);
                        if (iAccessibleChild) {
                            try{
                                if (iAccessibleChild.accName(0).match ( /E-mail+/)) {
                                    iAccessibleChild.accValue(0) = 'test@test.com';
                                }
                                if (iAccessibleChild.accName(0).match ( /Status+/)) {
                                    //Doesn't work not sure why...
                                    //iAccessibleChild.accValue(0) = 'Busy';
                                }
                               
                                Debug.Trace(iAccessibleChild.accName(0)+': '+iAccessibleChild.accValue(0));
                            }catch(e){
                                //Most likely the password edit box as you cannot access it...
                                Debug.Trace(e.number + ' /\\ ' + e.description);
                            }
                        }
                    }
                }
            }
        }
    }
}

This post was edited on 02-09-2010 at 06:55 PM by matty.
02-09-2010 03:51 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Active Accessibility Objects and ReadInterfacePtr - by matty on 02-03-2010 at 01:26 AM
RE: Active Accessibility Objects and ReadInterfacePtr - by Choli on 02-05-2010 at 05:44 PM
RE: Active Accessibility Objects and ReadInterfacePtr - by matty on 02-05-2010 at 06:37 PM
RE: Active Accessibility Objects and ReadInterfacePtr - by Mnjul on 02-05-2010 at 06:45 PM
RE: Active Accessibility Objects and ReadInterfacePtr - by matty on 02-05-2010 at 07:01 PM
RE: Active Accessibility Objects and ReadInterfacePtr - by Eljay on 02-08-2010 at 10:36 PM
RE: Active Accessibility Objects and ReadInterfacePtr - by matty on 02-09-2010 at 03:51 AM
RE: Active Accessibility Objects and ReadInterfacePtr - by Eljay on 02-09-2010 at 06:43 PM


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