Reda_Nihilistic Posted June 9, 2016 Posted June 9, 2016 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
ATR Posted June 9, 2016 Posted June 9, 2016 (edited) You can use the processlist function, and after the _arraysearch function to find your window Edited June 9, 2016 by ATR
Synapsee Posted June 9, 2016 Posted June 9, 2016 https://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm Quote Mode 1 (default) : a window titled Untitled - Notepad would be matched by "Untitled - Notepad", "Untitled", "Un", etc. so just WinSetState("rainbow", "", @SW_MAXIMIZE) can do the job.
ATR Posted June 9, 2016 Posted June 9, 2016 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)
Reda_Nihilistic Posted June 9, 2016 Author Posted June 9, 2016 thanks ATR, but I'm beginner and your solution seems very complicated
Reda_Nihilistic Posted June 9, 2016 Author Posted June 9, 2016 Synapsee yes that's work thanks, and how about if 'rainbow' was in the end of title, i mean can we call a window just by using a party of his name
Synapsee Posted June 9, 2016 Posted June 9, 2016 (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 June 9, 2016 by Synapsee
aleph01 Posted June 9, 2016 Posted June 9, 2016 I find Opt ("WinTitleMatchMode", -2) to be very forgiving, if applicable. _aleph_ Meds. They're not just for breakfast anymore.
ViciousXUSMC Posted June 10, 2016 Posted June 10, 2016 (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 June 10, 2016 by ViciousXUSMC Synapsee 1
Synapsee Posted June 11, 2016 Posted June 11, 2016 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
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