Sign in to follow this  
Followers 0
cmb99

ControlSend bugaboo

3 posts in this topic

Having trouble with this script. The first block runs well. The second block is an exact duplicate of the first, but once the dialog comes up "New Login", ControlSend quits, and no text is sent. I can't figure out why the first block would work and not the second. As a test, I deleted the first block, now the second block works, but not the third. It's as if I only get one chance with ControlSend.

; Block 1
Run("C:\Program Files\Java\jre1.5.0\bin\javaw.exe  -cp jts.jar;jcommon-0.9.0.jar;jfreechart-0.9.15.jar -Dsun.java2d.noddraw=true jclient/LoginFrame C:\PROGRA~1\Jts", "C:\PROGRA~1\Jts")
If WinWait("New Login") Then
    ControlSend("New Login", "", "", "XXXX{TAB}XXXX{ENTER}", 0)
EndIf
If WinWait("Universal Account UXXX") Then
    WinSetState("Universal Account UXXXX", "", @SW_MINIMIZE)
EndIf

; Block 2
Run("C:\Program Files\Java\jre1.5.0\bin\javaw.exe  -cp jts.jar;jcommon-0.9.0.jar;jfreechart-0.9.15.jar -Dsun.java2d.noddraw=true jclient/LoginFrame C:\PROGRA~1\Jts", "C:\PROGRA~1\Jts")
If WinWait("New Login") Then
    ControlSend("New Login", "", "", "XXXX{TAB}XXXX{ENTER}", 0)
EndIf
If WinWait("Universal Account UXXX") Then
    WinSetState("Universal Account UXXX", "", @SW_MINIMIZE)
EndIf

; Block 3
Run("C:\Program Files\Java\jre1.5.0\bin\javaw.exe  -cp jts.jar;jcommon-0.9.0.jar;jfreechart-0.9.15.jar -Dsun.java2d.noddraw=true jclient/LoginFrame C:\PROGRA~1\Jts", "C:\PROGRA~1\Jts")
If WinWait("New Login") Then
    ControlSend("New Login", "", "", "XXXX{TAB}XXXX{ENTER}", 0)
EndIf
If WinWait("Universal Account UXXX") Then
    WinSetState("Universal Account UXXX", "", @SW_MINIMIZE)
EndIf
Exit

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Why do you have the same exact code listed 3 times? Why not do something like this?

; Block 1

For $i = 1 to 3

Run("C:\Program Files\Java\jre1.5.0\bin\javaw.exe  -cp jts.jar;jcommon-0.9.0.jar;jfreechart-0.9.15.jar -Dsun.java2d.noddraw=true jclient/LoginFrame C:\PROGRA~1\Jts", "C:\PROGRA~1\Jts")

If WinWait("New Login") Then

    ControlSend("New Login", "", "", "XXXX{TAB}XXXX{ENTER}", 0)

EndIf

If WinWait("Universal Account UXXX") Then

    WinSetState("Universal Account UXXXX", "", @SW_MINIMIZE)

EndIf

Next

Edit: forgot to end quote

Edited by SerialKiller

Share this post


Link to post
Share on other sites

You may or may not have more luck with this code (it is possibly more correct and cohesive):

winWait("New Login")
controlSend("New Login", "", "", "XXXX{TAB}XXXX{ENTER}", 0)
winWait("Universal Account UXXX")
winSetState("Universal Account UXXXX", "", @SW_MINIMIZE)

P.S. Does the New Login window give initial focus to the control that wants the username?

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