Sign in to follow this  
Followers 0
sagdude

WinActive

10 posts in this topic

hi

Could somebody tell me why this doesn't work:

Run("notepad")

If WinActive("Un") Then

MsgBox(0, "", "Window was active")

EndIf

Thanks,

Raj

Share this post


Link to post
Share on other sites



The notepad window is not active when you check if it is, so nothing happens and the script ends.

Run("notepad")

WinWaitActive("Un")

If WinActive("Un") Then

MsgBox(0, "", "Window was active")

EndIf

Share this post


Link to post
Share on other sites

The notepad window is not active when you check if it is, so nothing happens and the script ends.

Run("notepad")

WinWaitActive("Un")

If WinActive("Un") Then

MsgBox(0, "", "Window was active")

EndIf

Thanks for your quick reply Manadar. So if I have to deal with a window that may pop up or may not pop up, the best option would be to use the timeout option of WinWaitActive?

Or is there any other better option?

Thanks,

Raj

Share this post


Link to post
Share on other sites

Of course, otherwise your script will be paused until if ever a window with this title (begin or end with) may be focused.

Share this post


Link to post
Share on other sites

Of course, otherwise your script will be paused until if ever a window with this title (begin or end with) may be focused.

Thanks for your help.

Raj

Share this post


Link to post
Share on other sites

Of course, otherwise your script will be paused until if ever a window with this title (begin or end with) may be focused.

Could somebody please tell me why this doesn't seem to work:

CODE
Func _disableDriverSigningWin2008()

If WinWaitActive("Windows Security","", 60) Then

ControlFocus("Windows Security", "", "DirectUIHWND1")

ControlClick("Windows Security", "", "DirectUIHWND1")

ControlFocus("Windows Security", "", "Button1")

ControlClick("Windows Security", "", "Button1")

EndIf

EndFunc

I am trying to install a software automatically when windows may pop up a security dialogue saying that this driver is not signed.

I am using windows 2008 64-bit version.

Thanks,

Raj

Share this post


Link to post
Share on other sites

Can post the AutoIt Window Info summary of the window and the control you're trying to target? Don't know about Win 2008 anything so I don't know if it's the problem.

Share this post


Link to post
Share on other sites

Can post the AutoIt Window Info summary of the window and the control you're trying to target? Don't know about Win 2008 anything so I don't know if it's the problem.

Hi,

Please see the Info below:

>>>> Window <<<<

Title: Windows Security

Class: #32770

Position: 173, 153

Size: 447, 222

Style: 0x96C80284

ExStyle: 0x00010101

Handle: 0x00000000000600BA

>>>> Control <<<<

Class: DirectUIHWND

Instance: 1

ClassnameNN: DirectUIHWND1

Advanced (Class): [CLASS:DirectUIHWND; INSTANCE:1]

ID:

Text:

Position: 0, 0

Size: 441, 197

ControlClick Coords: 117, 128

Style: 0x56000000

ExStyle: 0x00000000

Handle: 0x000000000006001A

>>>> Mouse <<<<

Position: 293, 303

Cursor ID: 2

Color: 0xD4D0C8

>>>> StatusBar <<<<

***********************

>>>> Window <<<<

Title: Windows Security

Class: #32770

Position: 114, 161

Size: 447, 222

Style: 0x96C80284

ExStyle: 0x00010101

Handle: 0x00000000000600BA

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Advanced (Class): [CLASS:Button; INSTANCE:1]

ID:

Text: &Install

Position: 269, 120

Size: 62, 22

ControlClick Coords: 35, 13

Style: 0x50002000

ExStyle: 0x00000000

Handle: 0x00000000000300CE

>>>> Mouse <<<<

Position: 421, 316

Cursor ID: 2

Thanks,

Raj

Share this post


Link to post
Share on other sites

Can you see if this works for you?

Run('notepad')

WinWaitActive('Untitled')
ControlSend('Untitled', '', 'Edit1', 'String')
I am sorry Authenticity. It works now. I was using a RunWait command to launch the application..so no wonder this code was not getting executed!

Thanks for your help.

Raj

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