Sign in to follow this  
Followers 0
Shibuya

Scrolling thru a window with tabs

3 posts in this topic

I'm trying to write a small function, one that scrolls thru a SysTabControl32 until the desired tab is active.

The script below is my attempt on it.

Tested it on IE7 with the Printing Preferences window of MS Document Image Writer, somehow the script exited the while loop without reaching the correct tab.

$title = "Printing Preferences"
$tab = "About"

Opt("WinTitleMatchMode", 3)
$print_handle = WinGetHandle($title)

MsgBox(0, "", $print_handle)

While WinExists($print_handle)
    ;MsgBox(0, "Details", "test1")
    If WinActive($print_handle, $tab) Then ExitLoop     ;exit loop when the required tab is active
    ;MsgBox(0, "Details", "test2")
    If WinWaitActive($print_handle) Then Send("^{TAB}") ;scrolls thru each tab
    ;MsgBox(0, "Details", "test3")
    Sleep(1500)     
WEnd

MsgBox(0, "Details", "test4")

Any idea what's wrong with the script? ;)


The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$title = "Printing Preferences"
$tab = "About"

Opt("WinTitleMatchMode", 2)
$print_handle = WinGetHandle($title)

MsgBox(0, "", $print_handle)

While WinExists($print_handle)
    WinActivate($print_handle)
    If ControlCommand($title,"","SysTabControl321","CurrentTab", "") = 3 Then ExitLoop
    ControlCommand($title,"","SysTabControl321","TabRight", "")
    Sleep(1500)  
WEnd

MsgBox(0, "Details", "test4")

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

$title = "Printing Preferences"
$tab = "About"

Opt("WinTitleMatchMode", 2)
$print_handle = WinGetHandle($title)

MsgBox(0, "", $print_handle)

While WinExists($print_handle)
    WinActivate($print_handle)
    If ControlCommand($title,"","SysTabControl321","CurrentTab", "") = 3 Then ExitLoop
    ControlCommand($title,"","SysTabControl321","TabRight", "")
    Sleep(1500)  
WEnd

MsgBox(0, "Details", "test4")

hmmm....is there no way I to reference the tab using the text on the tab, other than using the reference number returned by ControlCommand($title,"","SysTabControl321","CurrentTab", "")?


The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

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