sagdude Posted March 16, 2009 Share Posted March 16, 2009 hi Could somebody tell me why this doesn't work: Run("notepad") If WinActive("Un") Then MsgBox(0, "", "Window was active") EndIf Thanks, Raj Link to comment Share on other sites More sharing options...
jvanegmond Posted March 16, 2009 Share Posted March 16, 2009 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 github.com/jvanegmond Link to comment Share on other sites More sharing options...
sagdude Posted March 16, 2009 Author Share Posted March 16, 2009 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") ThenMsgBox(0, "", "Window was active")EndIfThanks 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 Of course, otherwise your script will be paused until if ever a window with this title (begin or end with) may be focused. Link to comment Share on other sites More sharing options...
sagdude Posted March 16, 2009 Author Share Posted March 16, 2009 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 Link to comment Share on other sites More sharing options...
sagdude Posted March 16, 2009 Author Share Posted March 16, 2009 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:CODEFunc _disableDriverSigningWin2008()If WinWaitActive("Windows Security","", 60) Then ControlFocus("Windows Security", "", "DirectUIHWND1") ControlClick("Windows Security", "", "DirectUIHWND1") ControlFocus("Windows Security", "", "Button1") ControlClick("Windows Security", "", "Button1")EndIfEndFuncI 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 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. Link to comment Share on other sites More sharing options...
sagdude Posted March 16, 2009 Author Share Posted March 16, 2009 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 17, 2009 Share Posted March 17, 2009 Can you see if this works for you? Run('notepad') WinWaitActive('Untitled') ControlSend('Untitled', '', 'Edit1', 'String') Link to comment Share on other sites More sharing options...
sagdude Posted March 17, 2009 Author Share Posted March 17, 2009 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now