Sign in to follow this  
Followers 0
kenp11w

Hidden Window

8 posts in this topic

Hi All,

I have a script that waits for an Adobe pop-up. The pop-up occurs during version mismatch with documents. AutoIT will miss the window if it pops up behind another window. We have an application menu that must be open and always on top status. Occasionally the Adobe pop-up will occur behind the window or any other window open at the time. We have to manually minimize the top window or bring the adobe po-up into focus before AutoIT "Sees the Window Title". We are using the option opt("WinDetectHiddenText",1)

Any ideas on how the window can be trapped in background or wen its hidden behind another?

1. See attachment in Word Doc of the hidden window that does not have focus.

2. See Code below:

;

; AutoIt Version: 3.0

; Language: English

; Platform: Win9x/NT

;

; Script Function:

; Close Adobe pop-up version check.

;

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)

$answer = MsgBox(4, "AutoIt Example (English Only)", "This script will run reply to the Adobe popup. Run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

; If "No" was clicked (7) then exit the script

If $answer = 7 Then

MsgBox(0, "AutoIt", "OK. Bye!")

Exit

EndIf

$i = 0

While $i <= 10

opt("WinDetectHiddenText",1)

; Wait for the Adobe Window to become active - it is titled "Adobe" on English systems

WinWaitActive("Adobe Acrobat","This")

; Now that the window is active type enter

; Use Send Enter

Send("{ENTER}")

; Now quit by request

WinClose("Adobe Acrobat","This")

; Now wait for nect pop-up before continuing

WinWaitClose("Adobe Acrobat","This")

WEnd

HiddenWindow.doc

Share this post


Link to post
Share on other sites



Hrm, if its a child window of another window, try setting this option:

Opt("WinSearchChildren", 1)

good luck!

Share this post


Link to post
Share on other sites

Hrm, if its a child window of another window, try setting this option:

Opt("WinSearchChildren", 1)

good luck!

I tired your option Opt("WinSearchChildren", 1) as well as Opt("WinDetectHiddenText",1) and

WinActivate("Adobe Acrobat","This")

No luck. It still does not find the pop-up until i move it up by refocusing

Share this post


Link to post
Share on other sites

Just a guess as cannot test or use AutoIt Info Tool on the picture, but it may spur on the answer for you if it is not exactly right.

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example (English Only)", "This script will run reply to the Adobe popup. Run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK. Bye!")
    Exit
EndIf

Opt("WinDetectHiddenText", 1)

$i = 0
While $i <= 10
    ; Wait for the Adobe Window to exist - it is titled "Adobe" on English systems
    If WinExists("Adobe Acrobat", "This file appears to use a new format") Then
        ; Check the Checkbox to not show window again
        ControlCommand("Adobe Acrobat", "This file appears to use a new format", 'Button1', 'Check')
        ; Click the OK button
        ControlClick("Adobe Acrobat", "This file appears to use a new format", 'Button2')
        ; Now wait for next pop-up before continuing
        WinWaitClose("Adobe Acrobat", "This file appears to use a new format")
    EndIf
    ; Idle CPU
    Sleep(500)
WEnd

The window would not need to be active if you use WinWait(), WinExists and Control*() functions in your script.

Share this post


Link to post
Share on other sites

Just a guess as cannot test or use AutoIt Info Tool on the picture, but it may spur on the answer for you if it is not exactly right.

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example (English Only)", "This script will run reply to the Adobe popup. Run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK. Bye!")
    Exit
EndIf

Opt("WinDetectHiddenText", 1)

$i = 0
While $i <= 10
; Wait for the Adobe Window to exist - it is titled "Adobe" on English systems
    If WinExists("Adobe Acrobat", "This file appears to use a new format") Then
    ; Check the Checkbox to not show window again
        ControlCommand("Adobe Acrobat", "This file appears to use a new format", 'Button1', 'Check')
    ; Click the OK button
        ControlClick("Adobe Acrobat", "This file appears to use a new format", 'Button2')
    ; Now wait for next pop-up before continuing
        WinWaitClose("Adobe Acrobat", "This file appears to use a new format")
    EndIf
; Idle CPU
    Sleep(500)
WEnd

The window would not need to be active if you use WinWait(), WinExists and Control*() functions in your script.

This works well. It finds the window in all cases. I saw that if i removed SLEEP(500) it uses more CPU. Is that the affect of the functions used?

Share this post


Link to post
Share on other sites

Is there anyway to make it use less CPU or is the SLEEP option used for that reason?

Share this post


Link to post
Share on other sites

That is what the sleep is for

Thanks for all your help.

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