Sign in to follow this  
Followers 0
Jcold8

Problems trying to login to application

7 posts in this topic

Hi, Im fairly new to this and I have been searching for awhile trying to figure my problem out. I'm trying to automate a login to an application.

Here is what I have so far:

ShellExecuteWait ("dvwin.exe")

WinWait ("OMSVision V.6.0.12", "", 5)

winwait ("OMSVision V.6.0.12 - Log On")

ControlSend ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]", "mytext")

The application loads and then a login box appears. I'm trying to type in the username but it just does nothing when it gets there. The cursor starts in the username field. I have tried using controlclick and some other things but I'm stuck.

Heres the info on the window:

>>>> Window <<<<

Title: OMSVision V.6.0.12 - Log On (The main window is the same without "- log on')

Class: FNWNS3100

Position: 338, 177

Size: 348, 279

Style: 0x96800000

ExStyle: 0x00000109

>>>> Control <<<<

Class: Button (The actual username and password fields are class:edit)

Instance: 7

ID: 1009

Text:

Position: 341, 180

Size: 344, 277

ControlClick Coords: 118, 47

Style: 0x5400000B

ExStyle: 0x00000000

>>>> Mouse <<<<

Position: 459, 227

Cursor ID: 2

Color: 0xFFFBFF

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Password:

User Name:

>>>> Hidden Text <<<<

Any help would be great.

Share this post


Link to post
Share on other sites



Sometimes it helps to get focus to the control first:

winwait ("OMSVision V.6.0.12 - Log On")

ControlFocus("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]") ; Username
ControlSetText ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]", "username") 

ControlFocus("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:2]") ; Guessing at password control
ControlSetText ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:2]", "password") 

ControlFocus("OMSVision V.6.0.12 - Log On", "", "[CLASS:Button; INSTANCE:7]") ; Logon button?
ControlClick("OMSVision V.6.0.12 - Log On", "", "[CLASS:Button; INSTANCE:7]", "mytext")

:whistle:


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

I tried typing that in and it seemed to work, but half the time nothing gets typed into the username field and password field.

Share this post


Link to post
Share on other sites

I tried typing that in and it seemed to work, but half the time nothing gets typed into the username field and password field.

Also I close the application then open it up again and it will put the username in but nothing else.

Share this post


Link to post
Share on other sites

I tried typing that in and it seemed to work, but half the time nothing gets typed into the username field and password field.

Also I close the application then open it up again and it will put the username in but nothing else.

AutoIt wouldn't have a problem with it, but maybe the app has timing issues updating the GUI or something... maybe slow it down a bit:

winwait ("OMSVision V.6.0.12 - Log On")
Sleep(500)
ControlFocus("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]") ; Username
Sleep(500)
ControlSetText ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]", "username")
Sleep(500)
ControlFocus("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:2]") ; Guessing at password control
Sleep(500)
ControlSetText ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:2]", "password")
Sleep(500)
ControlFocus("OMSVision V.6.0.12 - Log On", "", "[CLASS:Button; INSTANCE:7]") ; Logon button?
Sleep(500)
ControlClick("OMSVision V.6.0.12 - Log On", "", "[CLASS:Button; INSTANCE:7]", "mytext")

:whistle:


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

It was a timing issue and I have gotten it to work up to the point where it needs to click to OK button.

I messed around with the sleep function and controlclick function but my syntax is always wrong with controlclick.

ShellExecute ("dvwin.exe") ;executes OMS program
WinWaitActive ("OMSVision V.6.0.12 - Log On") ;waits for program to open
Sleep (100)
ControlFocus ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]") ;grabs focus on username field
Sleep (20)
ControlSend("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:1]", "omsclaims") ;username
Sleep (100)
ControlFocus ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:2]") ;grabs focus on password field
Sleep (20)
ControlSend("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:2]", "help1") ;password
Sleep (50)
ControlFocus ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:6]") ;grabs focus on the ok buttom
Sleep (20)
ControlClick ("OMSVision V.6.0.12 - Log On", "", "[CLASS:Edit; INSTANCE:6]" ("Left, 30, 20") ;clicks the ok button
;Sleep (5000)
;Winclose ("OMSVision V.6.0.12") ;closes the OMS window
;exit

After it logs in, it waits a couple seconds then exits the program.

Share this post


Link to post
Share on other sites

Thank you both for this example. I am slightly less clueless because of it.


This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......

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