meatwad420 Posted November 1, 2008 Share Posted November 1, 2008 I'm wanting to move and resize only windows with "username" in the title. I'm a bit lost on what the best way to accomplish this. I assume RegExp would be the easiest but I can't figure out how to use it. An example would help me greatly. Here is some code that sorts only windows I have open into an array and counts the number of windows. What do I need to add to select only windows with a certain text? $TableList = WinList() $j = 0 For $i = 1 to $TableList[0][0] If $TableList[$i][0] <> "" AND $TableList[$i][0] <> "Program Manager" AND IsVisible($TableList[$i][1]) Then $Table[$j] = $TableList[$i][0] $j = $j + 1 $ActiveTables = $j EndIf Next Thanks Link to comment Share on other sites More sharing options...
BrettF Posted November 1, 2008 Share Posted November 1, 2008 Hello and welcome to the forums. From the example you provided, I don't believe you need RegExp. Will this do? #include <Array.au3> $sub = "d"; String to find in title. Dim $output[1][2] ; Return array in following format. ; [n][0] = Title ; [n][1] = HWND $count = 1 $titles = WinList() For $i = 1 To $titles[0][0] If $titles[$i][0] <> "" AND BitAND(WinGetState($titles[$i][1]), 2) Then; Windows with a title and that are visible If StringInStr($titles[$i][0], $sub) Then; Make sure ReDim $output[$count + 1][2] $output[$count][0] = $titles[$i][0]; Title $output[$count][1] = $titles[$i][1]; HWND $count += 1; Increase Count EndIf EndIf Next $output[0][0] = $count - 1; Set [0][0] to be the number of windows found. _ArrayDisplay ($output); Show the data Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
meatwad420 Posted November 1, 2008 Author Share Posted November 1, 2008 Thanks for the help. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 2, 2008 Share Posted November 2, 2008 I'm wanting to move and resize only windows with "username" in the title. I'm a bit lost on what the best way to accomplish this. I assume RegExp would be the easiest but I can't figure out how to use it. An example would help me greatly. Here is some code that sorts only windows I have open into an array and counts the number of windows. What do I need to add to select only windows with a certain text? $TableList = WinList() $j = 0 For $i = 1 to $TableList[0][0] If $TableList[$i][0] <> "" AND $TableList[$i][0] <> "Program Manager" AND IsVisible($TableList[$i][1]) Then $Table[$j] = $TableList[$i][0] $j = $j + 1 $ActiveTables = $j EndIf Next Thanks All you need is: Opt("WinTitleMatchMode", -2); -2 = Any string match, case insensitive $TableList = WinList("username") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
BrettF Posted November 2, 2008 Share Posted November 2, 2008 Oh didn't know that! Sweet mate Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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