Shoutbox

Took me a few hours... - 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: Took me a few hours... (/showthread.php?tid=93824)

Took me a few hours... by Yustme on 02-12-2010 at 07:07 PM


Hi,

But i finally found out how to start an WLM window.

How can I fill in the email address and make it log in?


RE: Took me a few hours... by matty on 02-18-2010 at 04:48 PM

I have been doing a lot of work on a new style of polygamy launcher. Problem I am experiencing is that the password field isn't editable using Active Accessibility. If the user has saved their password you can use the code I was playing with. I am going to tell you now this is very advanced and probably not going to make any sense to you.

Javascript 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){
                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) = ''; // email goes here
                                }
                               
                                if (iAccessibleChild.accName(0).match ( /Sign+/)) { // I dont remember what the login button is labeled.
                                    iAccessibleChild.accDoDefaultAction(0); // this should sign the user in
                                }
                               
                            }catch(e){
                                //Most likely the password edit box as you cannot access it using Active Accessibility...
                            }
                        }
                    }
                }
            }
        }
    }
}


Good luck... you are going to need it after looking at this...
RE: Took me a few hours... by billyy on 02-18-2010 at 10:08 PM

i could have gone my whole life not knowing what === means O_O


RE: Took me a few hours... by Spunky on 02-18-2010 at 10:53 PM

It's a strict comparison (value and type)


RE: Took me a few hours... by matty on 02-19-2010 at 03:53 AM

In other words a bitwise comparison...

Normal comparisons if (1 == '1') is true because it is comparing the value. Bitwise comparison is checking, as Spunky said the value and type therefore 1 === '1' is false.


RE: Took me a few hours... by CookieRevised on 02-19-2010 at 06:07 AM

quote:
Originally posted by matty
Problem I am experiencing is that the password field isn't editable using Active Accessibility. If the user has saved their password you can use the code I was playing with.
Which, I think, isn't so much of a problem because it makes only sense that the user has saved passwords if he also wants to auto-launch several sessions. Otherwise, it isn't "automatic" because you would always need user input....

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

[OFF TOPIC]
Billyy, more detailed info about the difference between an equality (==, !=) and a identity (===, !==) operator can be found here:
CookieRevised's reply to Nudges, Updated.

Or in the Windows scripting documentation

[/OFF TOPIC]
RE: Took me a few hours... by Yustme on 02-19-2010 at 11:14 AM



Matty,

What does that function do?

This is not the new _Registry.js file right?


RE: Took me a few hours... by matty on 02-19-2010 at 12:02 PM

quote:
Originally posted by Yustme
Matty,

What does that function do?

This is not the new _Registry.js file right?
No it has nothing to do with the registry... Like I said it is likely above you. It sets the email address on the login screen.

quote:
Originally posted by CookieRevised
Which, I think, isn't so much of a problem because it makes only sense that the user has saved passwords if he also wants to auto-launch several sessions. Otherwise, it isn't "automatic" because you would always need user input....

What I was trying to accomplish was have an encrypted password stored in the registry, not in WLM and pass the email, encrypted password and status as command line parameters and log the user in that way. It was going to be a new way of doing polygamy.
RE: Took me a few hours... by billyy on 02-19-2010 at 04:54 PM

Oh yeah no i understood it after reading it... im a nublet but i learn fast.. there should be a page with all functions tough, that helped me a load with php, c, vb and easyest of all lsl (lsl = Linden Scripting Language. It's a realy easy kind of scripting language a lot like C used to make objects in the virtual world of SecondLife do stuffz..)
But i wish i could just memorise all commands...

But that was totaly off topic *-)

edit:
Okay... i master html and batch (lolz)

Again totally off-topic :^)


RE: Took me a few hours... by matty on 02-19-2010 at 06:52 PM

Download the scripting documentation... this will have all of the natively supported functions and properties.

Download the JScript documentation from Micrososoft... this will have all the native functions supported by JScript...

What you see above... none of that in any way is supported by JScript nateively. It is made possible by Messenger Plus! and the scripting engine.

So to have a list of functions supported isn't possible... Microsoft documents almost all of their APIs on MSDN


RE: Took me a few hours... by billyy on 02-19-2010 at 10:06 PM

mkay, ty matty :P


RE: Took me a few hours... by Yustme on 02-21-2010 at 12:28 PM

matty,

I think you misunderstood me. I have no intend to rewrite this script i made to a script that's somewhat like WINAPI. I pm-ed you about a function in your registry script:

JScript code:
function Registry_SetKeyValue(lKeyLocation, sKey, sKeyName, sKeyValue, lpType) {
    var hKey = Interop.Allocate(4);
    var lRetVal = Interop.Call('advapi32.dll', 'RegOpenKeyExW', lKeyLocation, sKey, 0, KEY_WRITE, hKey);
    if (lRetVal === ERROR_SUCCESS) {
        switch (lpType) {
            case REG_EXPAND_SZ :
            case REG_MULTI_SZ :
            case REG_SZ :
                sKeyValue = String(sKeyValue);
                var buff_size = sKeyValue.length;
                var lBufferSize = Interop.Allocate(4);
                lBufferSize.WriteDWORD(0, (2 * buff_size + 2));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, sKeyValue, lBufferSize.ReadDWORD(0));
                break;
            case REG_DWORD :
                var lKeyValue = Interop.Allocate(4);
                lKeyValue.WriteDWORD(0, (sKeyValue & 0xFFFFFFFF));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_DWORD, lKeyValue, 4);
                break;
            case REG_BINARY :
                sKeyValue = String(sKeyValue);
                var lBufferSize = Interop.Allocate(4);
                lBufferSize.WriteDWORD(0, (2 * sKeyValue.length + 2));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_BINARY, sKeyValue, lBufferSize.ReadDWORD(0));
                break;
            default : return false;
        }
        Registry_CloseKey(hKey.ReadDWORD(0));
        return lRetVal === ERROR_SUCCESS;
    } else { return false; }
}



This line:

JScript code:
var lRetVal = Interop.Call('advapi32.dll', 'RegOpenKeyExW', lKeyLocation, sKey, 0, KEY_WRITE, hKey);


Always returns false, no matter what I try.

A test case:

JScript code:
function OnEvent_Initialize(MessengerStart)
{
  var MPLkey = 'SOFTWARE\\Patchou\\Messenger Plus! Live';
var WLMkey;
var WLMexe;
 
 
if(Messenger.Version >= 8.5)
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = 'SOFTWARE\\Microsoft\\Windows Live\\Messenger';
}
 
else
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = WLMkey;
}
 
var resultWLMkey = Registry_SetKeyValue(HKEY_CURRENT_USER, WLMkey + '\\PerPassportSettings', 'DefaultMemberName', email, 'REG_BINARY');
 
var resultMPLkey = Registry_SetKeyValue(HKEY_CURRENT_USER, MPLkey, 'DefaultUser', email, 'REG_SZ');
 
Debug.Trace("Registry_SetKeyValue resultWLMkey = " + resultWLMkey);
Debug.Trace("Registry_SetKeyValue resultMPLkey = " + resultMPLkey);
}


Can't seem to figure out why.. Hope you can!
RE: RE: Took me a few hours... by whiz on 02-21-2010 at 03:57 PM

I don't know if this would affect it, but...

quote:
Originally posted by Yustme
JScript code:
function Registry_SetKeyValue(lKeyLocation, sKey, sKeyName, sKeyValue, lpType) {
    var hKey = Interop.Allocate(4);
    var lRetVal = Interop.Call('advapi32.dll', 'RegOpenKeyExW', lKeyLocation, sKey, 0, KEY_WRITE, hKey);
    if (lRetVal === ERROR_SUCCESS) {
        switch (lpType) {
            case REG_EXPAND_SZ :
            case REG_MULTI_SZ :
            case REG_SZ :                sKeyValue = String(sKeyValue);
                var buff_size = sKeyValue.length;
                var lBufferSize = Interop.Allocate(4);
                lBufferSize.WriteDWORD(0, (2 * buff_size + 2));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, sKeyValue, lBufferSize.ReadDWORD(0));
                break;
            case REG_DWORD :
                var lKeyValue = Interop.Allocate(4);
                lKeyValue.WriteDWORD(0, (sKeyValue & 0xFFFFFFFF));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_DWORD, lKeyValue, 4);
                break;
            case REG_BINARY :                sKeyValue = String(sKeyValue);
                var lBufferSize = Interop.Allocate(4);
                lBufferSize.WriteDWORD(0, (2 * sKeyValue.length + 2));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_BINARY, sKeyValue, lBufferSize.ReadDWORD(0));
                break;
            default : return false;
        }
        Registry_CloseKey(hKey.ReadDWORD(0));
        return lRetVal === ERROR_SUCCESS;
    } else { return false; }
}

(...)
JScript code:
function OnEvent_Initialize(MessengerStart)
{
  var MPLkey = 'SOFTWARE\\Patchou\\Messenger Plus! Live';
var WLMkey;
var WLMexe;
 
 
if(Messenger.Version >= 8.5)
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = 'SOFTWARE\\Microsoft\\Windows Live\\Messenger';
}
 
else
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = WLMkey;
}
 
var resultWLMkey = Registry_SetKeyValue(HKEY_CURRENT_USER, WLMkey + '\\PerPassportSettings', 'DefaultMemberName', email, 'REG_BINARY'); 
var resultMPLkey = Registry_SetKeyValue(HKEY_CURRENT_USER, MPLkey, 'DefaultUser', email, 'REG_SZ'); 
Debug.Trace("Registry_SetKeyValue resultWLMkey = " + resultWLMkey);
Debug.Trace("Registry_SetKeyValue resultMPLkey = " + resultMPLkey);
}


The Registry_SetKeyValue() function takes the key type as an enumeration (a variable name), whereas you have defined them as strings.  Try it without the single quotes.
RE: Took me a few hours... by Yustme on 02-21-2010 at 04:01 PM

Hi wiz,

No it never gets passed this line anyway:

if (lRetVal === ERROR_SUCCESS)


Edit:

I overlooked the last sentence:

quote:
The Registry_SetKeyValue() function takes the key type as an enumeration (a variable name), whereas you have defined them as strings.  Try it without the single quotes.

I'll try that, ty!
Hi whiz,

It seems that did the trick, thanks!
RE: Took me a few hours... by whiz on 02-21-2010 at 04:31 PM

You're welcome!  :)


RE: Took me a few hours... by Matti on 02-21-2010 at 10:38 PM

Perhaps this is a dumb question, but I have to ask it:

Are you sure you have defined those constants you use correctly at the top of your script? Such as:

Javascript code:
var ERROR_SUCCESS = 0x0;

since those are not set by Plus! itself, you need to define them yourself.
RE: Took me a few hours... by matty on 02-22-2010 at 03:52 AM

He is using the registry script from SS5 which declares the variables.