Automationuser Posted August 29, 2013 Posted August 29, 2013 Hello, I am trying to close a window with title something like "Hello All - ABC" and "Hello All - A1515" i tried using many regexp, but no luck WinClose("[REGEXPTITLE:(?i).*?Hello All -.*?]") Need little help..
JohnOne Posted August 29, 2013 Posted August 29, 2013 I'm regexp dullard but this could help. Opt("WinTitleMatchMode", 2) WinClose("Hello All") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
FireFox Posted August 29, 2013 Posted August 29, 2013 (edited) Hi, Try this: WinClose("[REGEXPTITLE:(?i)Hello All - (.*?)]") Br, FireFox. Edited August 29, 2013 by FireFox
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 Opt("WinTitleMatchMode", 2) WinClose("Hello All") I tried this. But din't work
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 @Firefox, Nope. That dint work too.
FireFox Posted August 29, 2013 Posted August 29, 2013 Very descriptive to say it does not work. Please use autoit tags to post your code. Can you paste here the window title using the info tool? Br, FireFox.
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 Here is the window title from the info tool Title: Hello All - ABC Class: #32770 Position: 368, 293 Size: 607, 244 Style: 0x14CE0044 ExStyle: 0x00010100 Handle: 0x00000000001D0DC4
FireFox Posted August 29, 2013 Posted August 29, 2013 What does this ouput? ConsoleWrite(WinGetHandle("[REGEXPTITLE:Hello All - (.*?)]") & @CrLf) ConsoleWrite(WinGetHandle("[TITLE:Hello All - ABC;CLASS:#32770]") & @CrLf)
FireFox Posted August 29, 2013 Posted August 29, 2013 Maybe the window does not handle the close message, try WinKill instead. Br, FireFox.
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 Those two lines fetches the following : 0x00320E82 0x001D0DC4 Second output is the correct handle of the window
Mat Posted August 29, 2013 Posted August 29, 2013 So there is another window on the desktop with a similar title? AutoIt Project Listing
FireFox Posted August 29, 2013 Posted August 29, 2013 (edited) So try this:AutoItSetOption("WinTitleMatchMode", 2) WinClose("[TITLE:Hello All - ;CLASS:#32770]")Br, FireFox. Edited August 29, 2013 by FireFox
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 @Mat : Nope, there is no other window on the desktop with a similar title. @Firefox : No luck with the below code. AutoItSetOption("WinTitleMatchMode", 2) WinClose("[TITLE:Hello All - ;CLASS:#32770]")
Mat Posted August 29, 2013 Posted August 29, 2013 @Mat : Nope, there is no other window on the desktop with a similar title So what does WinGetTitle return for the incorrect handle? AutoIt Project Listing
JohnOne Posted August 29, 2013 Posted August 29, 2013 $Hwnd = WinGetHandle("[TITLE:Hello All - ABC;CLASS:#32770]") WinClose($HWND) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 WinGetTitle returns 0 WinGetTitle("[TITLE:Hello All - ;CLASS:#32770]")
Mat Posted August 29, 2013 Posted August 29, 2013 WinGetTitle returns 0 WinGetTitle("[TITLE:Hello All - ;CLASS:#32770]") I meant this: ConsoleWrite(WinGetTitle(WinGetHandle("[REGEXPTITLE:Hello All - (.*?)]")) & @CrLf) AutoIt Project Listing
FireFox Posted August 29, 2013 Posted August 29, 2013 What if you add #RequireAdmin to the script?It does not make sense here.
Automationuser Posted August 29, 2013 Author Posted August 29, 2013 ConsoleWrite(WinGetTitle(WinGetHandle("[REGEXPTITLE:Hello All - (.*?)]")) & @CrLf) This is really weird. I have opened "Hello All - ABC" window. But WinGetTitle fetches the title of :Hello All - A1515 window which is not active. I cross checked again. 'Hello All - A1515' window is inactive.
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