Jump to content

Recommended Posts

hello, 

what is the equivalent of the star in autoit (to represent any string)

for exemple i want to open a window that start with 'rainbow', so can i do : WinSetState("rainbow *", "", @SW_MAXIMIZE)

thanks

Share this post


Link to post
Share on other sites

You can use the processlist function, and after the _arraysearch function to find your window

Edited by ATR

Share this post


Link to post
Share on other sites

u need use that page : https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm

like this : https://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm#WinTitleMatchMode

Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

That style it's possible too (i see that on a melba post somewhere) :

;is the default option
;Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

;use subStr Mode
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

;Add your stuff

;return too default mode
Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

;Other stuff

 

Edited by Synapsee

Share this post


Link to post
Share on other sites

A good time to learn some simple RegEx

https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm

 

Match mode is an easy fix, but a bit more shotgun where it will match anywhere, some easy regex can let you specify the start of the string and a lot more should you need to tweak it later on.  Plus you wont have to change your match mode for all other windows if you only need it for this particular one. 

 

WinSetState("[REGEXPTITLE:(?i)^rainbow.*]", "", @SW_MAXIMIZE)

 

https://regex101.com/r/sB3wJ9/1

Edited by ViciousXUSMC

Share this post


Link to post
Share on other sites
Quote

Match mode is an easy fix, but a bit more shotgun where it will match anywhere, some easy regex can let you specify the start of the string and a lot more should you need to tweak it later on.  Plus you wont have to change your match mode for all other windows if you only need it for this particular one.

well spotted

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

×
×
  • Create New...