Sign in to follow this  
Followers 0
Shibuya

WinActive Bug?

5 posts in this topic

I executed the following codes and found it keep getting stuck at line 36

WinWaitActive("Printing Preferences")

_GoToTab("Printing Preferences", "About")

If WinWaitActive("Printing Preferences", "About") Then MsgBox(0, "", "test")

Func IsVisible($handle, $wText = "")
  If BitAnd( WinGetState($handle, $wText), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

Func _GoToTab($w_title, $tab)
    While 1
        Opt("WinTitleMatchMode", 3)
        $list = WinList($w_title)
        Opt("WinTitleMatchMode", 1)
        
        For $i = 1 To $list[0][0]
            If $list[$i][0] <> "" And IsVisible($list[$i][1]) Then
                $print_handle = $list[$i][1]
            ;MsgBox(0, "Details", "Title=" & $list[$i][0] & @LF & "Handle=" & $list[$i][1])
                ExitLoop(2)
                
            EndIf
            
        Next
        
    WEnd
    
    While WinExists($print_handle)
    ;MsgBox(0, "Details", "test1")
        If WinActive($print_handle, $tab) Then ExitLoop; stuck here
    ;MsgBox(0, "Details", "test2")
        If WinActive($print_handle) Then Send("^{TAB}")
    ;MsgBox(0, "Details", "test3")
        Sleep(1500)
        
    WEnd
    
EndFunc

I used the following steps to test the codes:

1) Lauch any webpage using IE

2) Launch the print dialogue(e.g. Ctrl+p)

3) Select printer as Microsoft Office Document Image Writer

4) Click on "Preferences" button to launch the printing preferences window(this window should have 3 tabs: Page, Advanced and About)

5) Execute the script

The script is supposed to scroll thru the tabs until the "About" tab is active.

By using the commented MsgBox-es, I found the script to be stuck at line 36.

AutoIt version used v3.2.1.14

OS: WinXP w/ SP2

In case if required, I used IE7

PS: I've tried replacing line 36 using WinWaitActive with a timeout, same outcome.


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)

The script doesn't hang on line 36.

It is true right away because "About" is found on the page in the Hidden text.

So it exsts the While and returns to the top of the script.

_ Moving to Support were items like this belong...

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

The script doesn't hang on line 36.

It is true right away because "About" is found on the page in the Hidden text.

So it exsts the While and returns to the top of the script.

_ Moving to Support were items like this belong...

could you tell me what is the behavior that was being exhibited in your machine, with the un-commented messagebox lines?

what happended on my machine was:

1) Lauch IE7, launch print dialogue and printing preferences

2) I executed the script

3) I manually activate the printing preferences window

4) the message box "test1" is displayed, i close the message box

5) nothing else happens, script is still running

6) I manually click to the "About" tab, the message box "test" is displayed

7) I close the message box and the script terminates


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

I've verified with 2 other WinXP machines and 1 WinVista machines, all exhibited the same behavior

They did not exit the while loop until I've manually tabbed to the "About" tab.


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

@Shibuya,

Add the Opt line for TrayIconDebug,

run script,

then mouse over the AutoIt icon in the system tray.


[size="1"][font="Arial"].[u].[/u][/font][/size]

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