Sign in to follow this  
Followers 0
MattAlter

Help with ControlSend

9 posts in this topic

#1 ·  Posted (edited)

Hi.  I have an Excel macro that I already clikced with autoit.  Now I need to complete the input window.  I am trying with control send but its not working

ControlSend("Sign into Office 365", "", "usernameTextBox", "usernameHere")

I have tried variations on class name, still now luck

WindowsForms10.EDIT.app.0.190610d_r81_ad22

usernameTextBox

[NAME:usernameTextBox]

WindowsForms10.EDIT.app.0.190610d_r81_ad2

Here is the spy output

>>>> Window <<<<
Title:  Sign into Office 365
Class:  WindowsForms10.Window.8.app.0.190610d_r84_ad2
Position:   603, 334
Size:   393, 201
Style:  0x16C30000
ExStyle:    0x00050101
Handle: 0x003305BE

>>>> Control <<<<
Class:  WindowsForms10.EDIT.app.0.190610d_r84_ad2
Instance:   2
ClassnameNN:    WindowsForms10.EDIT.app.0.190610d_r84_ad22
Name:   usernameTextBox
Advanced (Class):   [NAME:usernameTextBox]
ID: 2035604
Text:   
Position:   15, 54
Size:   357, 23
ControlClick Coords:    81, 9
Style:  0x560100C0
ExStyle:    0x00000200
Handle: 0x001F0F94

>>>> Mouse <<<<
Position:   702, 422
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Enter your credentials to sign into Office 365
Cancel
Login
Password:
User ID:


>>>> Hidden Text <<<<

I am getting exit code 0.  Any suggestions?

Thanks

Matt

Edited by MattAlter

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Try this:

; window is already expected to be opened, and active
ControlSend("Sign into Office 365", "", "[NAME:usernameTextBox]", "usernameHere")
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

 

Try this:

; window is already expected to be opened, and active
ControlSend("Sign into Office 365", "", "[NAME:usernameTextBox]", "usernameHere")

No dice.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Try this...let's see where it's failing...send back output

$hWnd = WinGetHandle("Sign into Office 365")
If IsHWnd($hWnd) Then
    ConsoleWrite("found window" & @CRLF)
    WinActivate($hWnd)
Else
    ConsoleWrite("could not find window" & @CRLF)
    Exit 0
EndIf

$hControl = ControlGetHandle($hWnd, "", "[NAME:usernameTextBox]")
If IsHWnd($hControl) Then
    ConsoleWrite("found control" & @CRLF)
Else
    ConsoleWrite("could not find control" & @CRLF)
    Exit 0
EndIf

ControlFocus($hWnd, "", $hControl)
ControlSetText($hWnd, "", $hControl,"usernameHere")
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

This works

Send("username{TAB}password")

But, I have special charters in the passwords and it is not picking it up.  I have tried putting in in quotes and no go.

Share this post


Link to post
Share on other sites
Send("username{TAB}password",1)

Jos

Will that code send the TAB button? I think it will type it :)

i think you need to divide it two way.

1st:

Send("username{TAB}")

2nd:

Send("p@ssw{}ord", 1)

Share this post


Link to post
Share on other sites

Sends are unreliable.  I'd work on debugging what's wrong with the controlsettext.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0