Jump to content

Problem with WinActive


Recommended Posts

Hi all,

I'm trying to do the basic of testing if a Windows is active.

The windows title would looks like "HexEdit - C:\filename.pst" but even activating the windows I still get the same error of Window not Active.

Anybody could help me?

Thanks

CODE

$message = "Please select PST file that you want to recover."

$var = FileOpenDialog($message, "C:" & "\", "PST files (*.pst)", 1 + 4 )

Run("hexedit.exe " & $var)

If WinActive("HexEdit - "& $var) Then

MsgBox(0,"Windows","Active")

;ConsoleWrite ("OK" & @CRLF)

Else

MsgBox(0,"Windows","not active")

;ConsoleWrite("Windows is not active")

EndIf

Link to comment
Share on other sites

$message = "Please select PST file that you want to recover."

$var = FileOpenDialog($message, "C:" & "\", "PST files (*.pst)", 1 + 4 )

Run("hexedit.exe " & $var)

WinWait("HexEdit - "& $var) ; wait for the window to exist!

If WinActive("HexEdit - "& $var) Then
MsgBox(0,"Windows","Active")
;ConsoleWrite ("OK" & @CRLF)
Else
MsgBox(0,"Windows","not active")
;ConsoleWrite("Windows is not active")
EndIf

Edited by Manadar
Link to comment
Share on other sites

$message = "Please select PST file that you want to recover."

$var = FileOpenDialog($message, "C:" & "\", "PST files (*.pst)", 1 + 4 )

Run("hexedit.exe " & $var)

WinWait("HexEdit - "& $var) ; wait for the window to exist!

If WinActive("HexEdit - "& $var) Then
MsgBox(0,"Windows","Active")
;ConsoleWrite ("OK" & @CRLF)
Else
MsgBox(0,"Windows","not active")
;ConsoleWrite("Windows is not active")
EndIf
That worked. I didn't know I had to wait for the window to become active.

Thanks

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...