Jump to content
Sign in to follow this  
Automationuser

Closing an window using REGEXPTITLE

Recommended Posts

Automationuser

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

 

Share this post


Link to post
Share on other sites
FireFox

Hi,

Try this:

WinClose("[REGEXPTITLE:(?i)Hello All - (.*?)]")

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Automationuser
Opt("WinTitleMatchMode",  2)
WinClose("Hello All")
 
I tried this. But din't work :(
 

Share this post


Link to post
Share on other sites
Automationuser

@Firefox,

Nope. That dint work too.

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Automationuser

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

Share this post


Link to post
Share on other sites
FireFox

What does this ouput?

ConsoleWrite(WinGetHandle("[REGEXPTITLE:Hello All - (.*?)]") & @CrLf)
ConsoleWrite(WinGetHandle("[TITLE:Hello All - ABC;CLASS:#32770]") & @CrLf)

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
FireFox

Maybe the window does not handle the close message, try WinKill instead.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Automationuser

Those two lines fetches the following :

0x00320E82
0x001D0DC4

Second output is the correct handle of the window

Share this post


Link to post
Share on other sites
FireFox

So try this:

AutoItSetOption("WinTitleMatchMode",  2)
 
WinClose("[TITLE:Hello All - ;CLASS:#32770]")
Br, FireFox. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Automationuser

@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]")

Share this post


Link to post
Share on other sites
Mat

@Mat : Nope, there is no other window on the desktop with a similar title

So what does WinGetTitle return for the incorrect handle?

Share this post


Link to post
Share on other sites
Starg

What if you add #RequireAdmin to the script?

Share this post


Link to post
Share on other sites
FireFox

What if you add #RequireAdmin to the script?

It does not make sense here.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Automationuser

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.

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  

×