Jump to content

Recommended Posts

Posted

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
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
Posted

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?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...