Jump to content

Controlling Active Window


Recommended Posts

I have a script in which I have two IE windows, I have named them main and popup. I need to know that Main is the active window at the end of my loop. I initially started my script with WinGetHandle for Main, and ended it with WinActivate for Main. Intermittently I find that popup is the active window after the final WinActivate command. At this point I have two questions. Im still pretty new to Autoit, so I may find Im missing some questions.

1. Is there a definite way to verify that Main is my active window at the end of the loop. Currently Im considering closing popup before activating the Main window, but Im still running into problems with focus.

2. What commands can I use to debug the script? Im thinking about showing the handle for Main throughout the script to see when I loose the Main window. What command can I use to show the handle?

Thanks,

Spammeblind

Link to comment
Share on other sites

1: WinActive in the help file

2: Search for +Assert +dbg

I'm working with SciTE Version 1.73

I found WinActive in Help, but there are No Topics found for the searches for +Assert +dbg, or searches or Assert dbg.

Am I missunderstanding your post?

Thank you,

Spammeblind

Link to comment
Share on other sites

I'm working with SciTE Version 1.73

I found WinActive in Help, but there are No Topics found for the searches for +Assert +dbg, or searches or Assert dbg.

Am I missunderstanding your post?

Thank you,

Spammeblind

I think he meant the AutoIt help file, usually at: C:\Program Files\AutoIt3\AutoIt3.chm

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I'm working with SciTE Version 1.73

I found WinActive in Help, but there are No Topics found for the searches for +Assert +dbg, or searches or Assert dbg.

Am I missunderstanding your post?

Thank you,

Spammeblind

Searching the forum would probably be better..:rolleyes:

Func dbg($msg, $line = @ScriptLineNumber, $err = @error, $ext = @extended)
    If Not @Compiled Then
        ConsoleWrite("(" & $line & ") := (" & $err & ")(" & $ext & ") " & $msg & @CRLF)
    EndIf
EndFunc   ;==>dbg
Func Assert($bool, $msg = "", $line = @ScriptLineNumber, $err = @error, $ext = @extended)
   If Not $bool Then 
      dbg("FAILURE: Assert failed :" & $msg, $line, $err, $ext)
   EndIf
EndFuncoÝ÷ Ù&¦¦W®±¨jëh×6dbg("This is a test. Click on this line in scites output pan")
Assert(0, "Click on this line to")
Assert($hExpected == $hCurrent, "The window handel has changed!")

EDIT: Saple usage

Edited by Uten
Link to comment
Share on other sites

I want to do something similar, but I don't have a clue which window could be active, is there Somethin like GetActiveWindow() which returns the handle/title of the active window?

WinGetHandle("", "")

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...