kdot Posted February 19, 2018 Share Posted February 19, 2018 I'm new to autoit. I have 10 chrome processes which open @ 400x545 . How can I put them next to each other automatically (as shown in the attachment). Res: 2560 x 1440 Class: Chrome_WidgetWin_1 Thanks Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2018 Share Posted February 19, 2018 Have a look at the WinMove function. WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
kdot Posted February 19, 2018 Author Share Posted February 19, 2018 1 minute ago, TheXman said: Have a look at the WinMove function. WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) Can you have it set the x and y automatically based on the resolution? Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2018 Share Posted February 19, 2018 (edited) It's a function. You set the x and y when you write the command. You can base the x,y, w, and h based on the previous window's x,y,w,and h. You can get that info using the WinGetPos function. Edited February 19, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
kdot Posted February 19, 2018 Author Share Posted February 19, 2018 I've got the position and title of window 1 & 2 but get an error when running it. Is there something else I have to include? WinMove ( "Example" -7, 1) WinMove ( "Example" 379, 2) Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2018 Share Posted February 19, 2018 (edited) The WinMove command has 4 required parameters. WinMove ( "title", "text", x, y [, width [, height [, speed]]] ) Also, if you have multiple windows with the same title, you will probably want to use the INSTANCE property of the advanced window description title. Refer to: https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm Edited February 19, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
kdot Posted February 19, 2018 Author Share Posted February 19, 2018 I don't need to set the width or height I only need to move each window. Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2018 Share Posted February 19, 2018 (edited) 2 minutes ago, kdot said: I don't need to set the width or height I only need to move each window. The command has 4 required parameters: title, text, x and y. If you aren't using the text parameter, then use "". The help file examples are very useful. Edited February 19, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2018 Share Posted February 19, 2018 (edited) Here's a very simple example using notepad windows. #include <Array.au3> ;Launch 4 notepad windows Run("notepad.exe") Run("notepad.exe") Run("notepad.exe") Run("notepad.exe") ;Wait a couple of seconds for the windows to load Sleep(2000) ;Get a list of the window handles Local $aWinList = WinList("Untitled - Notepad") _ArrayDisplay($aWinList) ;Resize and move windows WinMove($aWinList[1][1], "", 0, 0, 200, 200) WinMove($aWinList[2][1], "", 200, 0, 200, 200) WinMove($aWinList[3][1], "", 0, 200, 200, 200) WinMove($aWinList[4][1], "", 200, 200, 200, 200) Since I'm not sure how new to AutoIt you are, when you see the display of the array, close it, and the script will continue. Edited February 19, 2018 by TheXman kdot 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
kdot Posted February 19, 2018 Author Share Posted February 19, 2018 That seems to work. thanks. Link to comment Share on other sites More sharing options...
kdot Posted February 21, 2018 Author Share Posted February 21, 2018 On 2/19/2018 at 10:13 PM, TheXman said: Here's a very simple example using notepad windows. #include <Array.au3> ;Launch 4 notepad windows Run("notepad.exe") Run("notepad.exe") Run("notepad.exe") Run("notepad.exe") ;Wait a couple of seconds for the windows to load Sleep(2000) ;Get a list of the window handles Local $aWinList = WinList("Untitled - Notepad") _ArrayDisplay($aWinList) ;Resize and move windows WinMove($aWinList[1][1], "", 0, 0, 200, 200) WinMove($aWinList[2][1], "", 200, 0, 200, 200) WinMove($aWinList[3][1], "", 0, 200, 200, 200) WinMove($aWinList[4][1], "", 200, 200, 200, 200) Since I'm not sure how new to AutoIt you are, when you see the display of the array, close it, and the script will continue. Is it possible to do something more advanced like grab the current resolution and move each window to fill the entire monitor? Link to comment Share on other sites More sharing options...
TheXman Posted February 21, 2018 Share Posted February 21, 2018 (edited) 50 minutes ago, kdot said: Is it possible to do something more advanced like grab the current resolution and move each window to fill the entire monitor? Yes, that's possible. You can get the monitor resolution and workable area info by using the _WinAPI_GetMonitorInfo function. Then, it's just a matter of calculation the window size and positions. Edited February 21, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
TheXman Posted February 21, 2018 Share Posted February 21, 2018 The example below should give you a decent starting point. I left out some of the fun parts like getting the monitor's resolution and calculating what your width and height should be. I mean, why should I have all of the fun, right? #include <Array.au3> example() Func example() Const $kWIDTH = 250 Const $kHEIGHT = 300 Local $aWinList Local $iRow, $iCol, $iIndex, $iX, $iY ;Launch 10 notepad windows For $i = 1 To 10 Run("notepad.exe") Next ;Wait a couple of seconds for the windows to load Sleep(2000) ;Get a list of the window handles $aWinList = WinList("Untitled - Notepad") ;~ _ArrayDisplay($aWinList) ;Display 2 x 5 array of windows $iIndex = 0 For $iRow = 0 To 1 For $iCol = 0 To 4 ;Resize and move windows into place $iIndex += 1 $iX = $iCol * $kWIDTH $iY = $iRow * $kHEIGHT WinMove($aWinList[$iIndex][1], "", $iX, $iY, $kWIDTH, $kHEIGHT) Next Next EndFunc CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman 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