Jump to content
Sign in to follow this  
dddkkk

.net control for auto login script

Recommended Posts

dddkkk

Hi fellas,

Im just getting started with AutoIT and im trying to get some automated testing scripts going in it for a .net application (written in c#) Im testing. I know this is a newbie question but im stuck...I'm simply seeing if i can get an autologin script going in to start out. The login screen for my application does not have a form title so that could be my first problem. My script actually gets the executable to bring up the screen and defaults to the password text box with the blinking cursor. I have in my program to send the password which is 'admin' but it doesn't write it in.

Here is the start of it

run ('C:\directory of the .exe')

$sPassword = "admin"

Send("sPassword")

The GUI for login has the following four text boxes the first three are already populated with the correct info:

sqlserver (already poplulated)

database (already populated)

username (already populated)

password (need to populated)

Any help would be greatly appreciated. In addidition if anyone thinks it is possible to clear all the remembered values of the fields out and the have a script put all 4 values in I wouldn't be opposed to doing it that way either.

Share this post


Link to post
Share on other sites
Valuater

1 this would be correct

$sPassword = "admin"

Send($sPassword)

... however

2 ControlSend()

Would be more effective and make sure the info is sent to the correct control

you will need the control info and you can get that from

Start > Autoit V3 > Autoit Window Info

see help file

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
dddkkk

1 this would be correct

$sPassword = "admin"

Send($sPassword)

... however

2 ControlSend()

Would be more effective and make sure the info is sent to the correct control

you will need the control info and you can get that from

Start > Autoit V3 > Autoit Window Info

see help file

8)

thanks but what should i put in for the title and text parameters the windows info view shows them to be blank. also should i highlight the label with the viewer or the text box next to it that i want the password to go into?

Edited by dddkkk

Share this post


Link to post
Share on other sites
dddkkk

Update,

I got the control Id of the text box with the windows viewer and put it in like this. Still does not pump in the password. The cursor just keeps blinking. Any other thoughts this is making me crazy shouldn't be this hard :)

run ('C:\directory of .exe')

$sPassword = "admin"

controlSend( "", "", 3285454 , "sPassword")

Edited by dddkkk

Share this post


Link to post
Share on other sites
PsaltyDS

run ('C:\directory of .exe')
$sPassword = "admin"
controlSend( "", "", 3285454 , "sPassword")

With the variable reference instead of the variable name in quotes?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dddkkk

post-23944-1181049137_thumb.gif

thanks that did not help either though here is a print of the login screen if that gives anyone any ideas ?

Edited by dddkkk

Share this post


Link to post
Share on other sites
dddkkk

could it be that AutoIT doesn't play with this control period? the control is technically a windows form but its .net code written on a mere mortals frawework.

Share this post


Link to post
Share on other sites
PsaltyDS

thanks that did not help either though here is a print of the login screen if that gives anyone any ideas ?

You clipped the window title bar, and you did not provide WinTitle/hWnd or WinText parameters to ControlSend(). Why?

Did you try it with those parameters provided?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dddkkk

There is no title on the screen or a text value when I user 'Autoit Window Info' and highlight on the form. I also highlighted on the text box right next to the label 'password' and got back the component Id which is the script you see below and the windows class of the text box. I tried that to and that did not work either. Here are the values i get when I used 'Window Info View' on the text box next to password.

>>>> Window <<<<

Title:

Class: WindowsForms10.window.8.app.0.33c0d9d

Position: 230, 152

Size: 340, 265

Style: 0x16800000

ExStyle: 0x00050101

>>>> Control <<<<

Class: WindowsForms10.EDIT.app.0.33c0d9d

Instance: 6

ID: 393934

Text:

Position: 343, 350

Size: 215, 20

ControlClick Coords: 17, 15

Style: 0x560100E0

ExStyle: 0x00000200

Again Ive tired it with the Control ID and Class Combo with no success :)

Is there any easier way like creating and .ini file with all four values for each field and writing them in? I think ive seen that done before? I really just need to get into the app to try to start automating. Should I be useing the info from the txt box control or another control on the form?

Share this post


Link to post
Share on other sites
dddkkk

has anyone gotten a login script to run with windows forms using AutoIT? prlly a stupid question..Im a total newb so Im having a feeling its probably an error on my end.

Share this post


Link to post
Share on other sites
PsaltyDS

>>>> Window <<<<

Title:

Class: WindowsForms10.window.8.app.0.33c0d9d

Position: 230, 152

Size: 340, 265

Style: 0x16800000

ExStyle: 0x00050101

>>>> Control <<<<

Class: WindowsForms10.EDIT.app.0.33c0d9d

Instance: 6

ID: 393934

Text:

Position: 343, 350

Size: 215, 20

ControlClick Coords: 17, 15

Style: 0x560100E0

ExStyle: 0x00000200

The control ID here is different from your last. Is it changing?

This is what it would look like to use the Window class from what you show here:

Opt("WinTitleMatchMode", 4)
$GuiCtrlPass = 393934
$sPassword = "admin"
controlSend( "[CLASS:WindowsForms10.window.8.app.0.33c0d9d]", "", $GuiCtrlPass , $sPassword)oÝ÷ Ø    趫¦,¸¥Ü²Ç¦nX§Ø^
V¬°Ö¦xÓ_¢»ayÊ'¶º%o+ayÉZ²ÉÚæ§v)쵩Üz{¦mêì'Â¥u·ºÚ"µÍÜ
    ][ÝÕÚ[]SX]Ú[ÙI][ÝË
BÌÍÑÝZPÝÜÈH  ][ÝÕÚ[ÝÜÑÜÌLQUÌØÌY   ][ÝÈ  [È
ÌÍÜÔÜÝÛÜH   ][ÝØYZ[][ÝÂÛÛÛÙ[
    ][ÝÖÐÓTÔÎÚ[ÝÜÑÜÌLÚ[ÝËÌØÌYI][ÝË  ][ÝÉ][ÝË    ÌÍÑÝZPÝÜÈ    ÌÍÜÔÜÝÛÜ
oÝ÷ Øíë²Ø¥ö¢+-æèÅ©pk+"Ø^±©_ö%¡Æ­ðØbØ^Â)Ý£²azv¬jexÊ.±à¥É(Ø^®(!µÊ(­Ø§j׬jwljey'§vh ض+ZºÚ"µÍÜ
    ][ÝÓ[ÝÙPÛÛÜ[ÙI][ÝË
BÌÍÜÔÜÝÛÜH  ][ÝØYZ[][ÝÂ[ÝÙPÛXÚÊ    ][ÝÓQ ][ÝË

LÍ
BÙ[
    ÌÍÜÔÜÝÛÜJ

The last grim possibility is that the program blocks simulated inputs to prevent scripting the login.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dddkkk

thanks man youve been huge help. unfortanelty i couldn't get the second case to work which is the one i like the most that you posted but i got the third case with the hard coded mouse cordinates actually to work :)

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  

×