Jump to content

If Expression Control Problem


Recommended Posts

I am currently trying to put an automated test together using Autoit. The GUI that I need to manage uses

systabcontrol321. I put a Func together that either tabs left or right depending on the last tab window selected. The GUI has 10 systabcontrols and the main part of the program reads its commands from a text file and calls this function. The problem: as it sequences through the tabs and checks the "current tab" it will never find 10. ex select 1,2,3,4,5,6,7,8,9,10 all should take the right tab if expression. All is fine up to 9, but when it hits 10 it takes the left tab . I've msgboxed the variables and the $name is greater than $last_name and $window is equal to $last_window but the if expression fails and falls through to the else.

Here is the func and THANKS for the help.

After a little of testing the problem is: The conversion of the string "10" to a numeric number.

This also fails with the production code.

Func SysTabControl_Focus( $window, $name )

WinActivate( $window )

; Check to see if we are already on the correct tab, if so then return 0

$ret = ControlCommand( $window, "", "SysTabControl321", "CurrentTab", "" )

if $ret = $name Then

; store the last window and tab before return in order to quickly find the next tab

$last_window=$window

$last_name=$name

return 0

EndIf

; If $name is greater than $last_name and we are still on the same $window then tab right else tab left

if $name > $last_name and $window = $last_window Then

for $a = 1 to 15 step 1

ControlCommand( $window, "", "SysTabControl321", "TabRight", "" )

$ret = ControlCommand( $window, "", "SysTabControl321", "CurrentTab", "" )

if $ret = $name Then

; store the last window and tab before return in order to quickly find the next tab

$last_window=$window

$last_name=$name

return 0

EndIf

Next

Else

; $name is less than $last_name or we are on a NEW $window

for $a = 1 to 15 step 1

ControlCommand( $window, "", "SysTabControl321", "TabLeft", "" )

$ret = ControlCommand( $window, "", "SysTabControl321", "CurrentTab", "" )

if $ret = $name Then

; store the last window and tab before return in order to quickly find the next tab

$last_window=$window

$last_name=$name

return 0

EndIf

Next

EndIf

MsgBox( 0, "SysTabControl_Focus()", "Unable to find SysTabControl321 Window Name=" & $window & " Tab Name=" & $name)

return 1

EndFunc

Edited by mikedelk
Link to comment
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
 Share

  • Recently Browsing   0 members

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