dwaynek Posted June 2, 2011 Posted June 2, 2011 so i know i can use WinGetText to obtain Visible Text info from a window but what if i have multiple windows with the exact same name? how do i get Visible Text info from each window and how would i be able to use that info to manipulate each window individually (eg if i want to move each window to a different location on the screen)?
smartee Posted June 2, 2011 Posted June 2, 2011 hi dwaynek, Use windows handles to manipulate windows rather than their titles. Here's a quick ex: ;simulate some open windows Run("notepad.exe") Run("notepad.exe") WinWait("Untitled - Notepad") Local $aSomeText[3] = [2, "This is some text", "This is some different text"] ;get list with titles and handles $hArray = WinList("Untitled - Notepad") ConsoleWrite($hArray[0][0] & " notepad windows found" & @CRLF) ;write some stuff For $i = 1 To $hArray[0][0] ControlSetText($hArray[$i][1], "", "[CLASS:Edit; INSTANCE:1]", $aSomeText[$i]) Next Hope this helps , -smartee
dwaynek Posted June 2, 2011 Author Posted June 2, 2011 great! is there a way to move each window using handles? because WinMove doesn't take a handle as a parameter.
smartee Posted June 2, 2011 Posted June 2, 2011 (edited) Glad to help ..is there a way to move each window using handles? because WinMove doesn't take a handle as a parameter. Yes it does, Here's another example :;open some notepad windows Run("notepad.exe") Run("notepad.exe") ;Wait on notepads to open Do $hArray = WinList("Untitled - Notepad") Sleep(250) Until $hArray[0][0] > 1 ConsoleWrite($hArray[0][0] & " notepad windows found" & @CRLF) Local $aSomeText[3] = [2, "This is some text", "This is some different text"] ;write and move some stuff more visually For $i = 1 To $hArray[0][0] WinActivate($hArray[$i][1]) WinWaitActive($hArray[$i][1]) WinMove($hArray[$i][1], "", 100 * $i, 50 * $i, 500, 400, 10) ControlSend($hArray[$i][1], "", "[CLASS:Edit; INSTANCE:1]", $aSomeText[$i]) Sleep(1000) Next Hope this helps -smartee EDIT: Removed an unnecessary call WinList() Edited June 2, 2011 by smartee
dwaynek Posted June 2, 2011 Author Posted June 2, 2011 awesome! that's exactly what i needed! you da man!!
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