Jump to content

Recommended Posts

Posted

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

Posted (edited)

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

Edited by ATR
Posted
Local $aProcessList = ProcessList()
    For $i = 1 To $aProcessList[0][0]
        _ArrayAdd($aProcessList, $aProcessList[$i][0])
    Next
    $Prog = _ArraySearch($aProcessList, "lsass.exe")
    $Extract = _ArrayExtract($aProcessList, $Prog, $Prog, 0, 0)
    $Windows = _ArrayToString($Extract)
    ConsoleWrite("Prog :" & $Windows & @LF)

 

Posted (edited)

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
Posted (edited)

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...