jriverac Posted December 22, 2010 Share Posted December 22, 2010 Hallo,I am a newbie to AutoIt and slowly making some progress, but I got stuck at this point and need some help.One of my windows is called"LAN 01-11 22/12/2010 (static)"I want to maximize it, so I wrote this piece of code (with some effort)$title="LAN 01-11 22/12/2010 (static)"WinSetState($title, "", @SW_MAXIMIZE)And it works!!However I need something more generic, not depending on dates, something like;$title="LAN ??-11 ??/??/2010 (static)"WinSetState($title, "", @SW_MAXIMIZE)But I have no idea how to achieve this!!I tried:$title="LAN ([0-9]{2})-11 ([0-9]{2}&"/"&([0-9]{2}&"/2010 (static)"and similar things but the regular expressions are a mistery to me.Anyone can help?Hope I stated the issue clearly.ThanksJUan Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 22, 2010 Share Posted December 22, 2010 #include <Array.au3> $aWinList = WinList("LAN") _ArrayDisplay($aWinList) Perhaps the WinList function might be what you're looking for? Link to comment Share on other sites More sharing options...
JohnOne Posted December 22, 2010 Share Posted December 22, 2010 Opt("WinTitleMatchMode", 2) $title="(static)" WinSetState($title, "", @SW_MAXIMIZE) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
UEZ Posted December 22, 2010 Share Posted December 22, 2010 (edited) What about this? $title = "LAN 01-11 22/12/2010 (static)" $aString = StringRegExp($title, "(?i:LAN (\d.)-(\d.) (\d.)/(\d.)/20(\d.) \(static\))", 2) ConsoleWrite($aString[0] & @CRLF) WinSetState($aString[0], "", @SW_MAXIMIZE) Br, UEZ Edited December 22, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 22, 2010 Share Posted December 22, 2010 Opt("WinTitleMatchMode", 2)$title="(static)"WinSetState($title, "", @SW_MAXIMIZE)Overly simple and should work just fine Link to comment Share on other sites More sharing options...
jriverac Posted December 22, 2010 Author Share Posted December 22, 2010 (edited) Wow!! Thanks so much for all the replies!! I will test them all... However I must say that there are more than one window that shares the (static) end. Also I do not know the date when this script will be executed and which date will be reflected in the title... For instance: Today is 22/12/2010. I have three windows called: "LAN 01-11 22/12/2010 (static)" "UPC 02-11 21/12/2010 (static)" "ACD 02-11 22/12/2010 (static)" The first 3 letters are fixed in time and the last 8 "(static)" also fixed across all windows, but the digits vary from day to day in a somehow "random" manner. And I need to activate all of them. How would you proceed? What I need is. 1) activate LAN xx-xx xx/xx/xxxx (static), then do something 1) activate UPC xx-xx xx/xx/xxxx (static), then do something 1) activate ACD xx-xx xx/xx/xxxx (static), then do something Some more info, If I use $title="LAN", then a window that is not visible but it is called "LAN" gets the focus, so I cannot use only the beginning... Thanks again Juan Edited December 22, 2010 by jriverac Link to comment Share on other sites More sharing options...
JohnOne Posted December 22, 2010 Share Posted December 22, 2010 So when you look at the screen, how do you know what you want to work on? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
UEZ Posted December 22, 2010 Share Posted December 22, 2010 Next try: $title = "LAN 01-11 22/12/2010 (static)" & @LF & _ "LAN 01-11 22/12/2010 (static)" & @LF & _ "UPC 02-11 21/12/2010 (static)" & @LF & _ "ACD 02-11 22/12/2010 (static)" & @LF & _ "BCD 02-11 22/12/2010 (static)" & @LF & _ "APC 02-11 21/12/2010 (static)" & @LF $aString = StringRegExp($title, "(?i:(LAN|UPC|ACD) (\d.)-(\d.) (\d.)/(\d.)/20(\d.) \(static\))", 4) for $i = 0 to UBound($aString) - 1 $match = $aString[$i] ConsoleWrite($match[0] & @CRLF) WinSetState($match[0], "", @SW_MAXIMIZE) Next I hope it helps... Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Malkey Posted December 22, 2010 Share Posted December 22, 2010 Try this. ; For testing have SciTE, AutoIt Help, and AU3Info windows running. Local $aTitle[3] = ["[REGEXPTITLE:(?i)(.+scite.+)]", "[REGEXPTITLE:(?i)(.+help)]", "[REGEXPTITLE:(?i)(.+info)]"] ; or #cs Local $aTitle[3] = ["[REGEXPTITLE:(?i)LAN \d{2}-\d{2} \d{2}/\d{2}/\d{4} \(static\)]", _ "[REGEXPTITLE:(?i)UPC \d{2}-\d{2} \d{2}/\d{2}/\d{4} \(static\)]", _ "[REGEXPTITLE:(?i)ACD \d{2}-\d{2} \d{2}/\d{2}/\d{4} \(static\)]"] #ce For $i = 0 To UBound($aTitle) - 1 If WinExists($aTitle[$i]) Then WinActivate($aTitle[$i]) WinWaitActive($aTitle[$i], "", 4) If WinActive($aTitle[$i]) <> 0 Then WinSetState($aTitle[$i], "", @SW_MAXIMIZE) EndIf Next Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 23, 2010 Share Posted December 23, 2010 A spin off of UEZ's example using StringRegExp and using WinList to do it $aWinList = WinList() For $i = 1 To $aWinList[0][0] If StringRegExp($aWinList[$i][0], "(?i:(LAN|UPC|ACD) (\d.)-(\d.) (\d|\d.)/(\d|\d.)/20(\d.) \(static\))", 0) = 1 Then If WinExists($aWinList[$i][0]) Then WinSetState($aWinList[$i][0], "", @SW_MAXIMIZE) EndIf Next Link to comment Share on other sites More sharing options...
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