AllEyezOnMe 0 Posted June 20, 2019 I want to do as the title similar to Opt("WinTitleMatchMode", 2) if ProcessExists("notepad.exe") Then winactivate("notepad") MouseClick("left", @DesktopWidth / 2, @DesktopHeight / 2) ;notepad instead of desktop and divide width and height by 2 Any examples would be great! Share this post Link to post Share on other sites
Jos 2,275 Posted June 20, 2019 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
iuc73663 0 Posted June 20, 2019 Not sure if this is what you are looking for, but I would approach this as follows: -Find where you want to move the window -Calculate the size you want to window to be -Resize window to that size -Move window using this function: https://www.autoitscript.com/autoit3/docs/functions/WinMove.htm Hope it helps. Share this post Link to post Share on other sites
AllEyezOnMe 0 Posted June 21, 2019 3 hours ago, iuc73663 said: Not sure if this is what you are looking for, but I would approach this as follows: -Find where you want to move the window -Calculate the size you want to window to be -Resize window to that size -Move window using this function: https://www.autoitscript.com/autoit3/docs/functions/WinMove.htm Hope it helps. Show me where I said I wanted to move or resize any window? pls stop spam Share this post Link to post Share on other sites
jdelaney 313 Posted June 21, 2019 $bSetupFakeWindows = True If $bSetupFakeWindows Then For $i = 0 To 4 Run("notepad.exe") Next Sleep(1000) $aWin = WinList("[CLASS:Notepad]") For $i = 1 To UBound($aWin)-1 $xRandom = Random(1,800,1) $yRandom = Random(1,800,1) $hRandom = Random(200,500) $wRandom = Random(200,500) WinMove($aWin[$i][1],"",$xRandom,$yRandom,$wRandom,$hRandom) Next EndIf $aWin = WinList("[CLASS:Notepad]") For $i = 1 To UBound($aWin)-1 WinActivate($aWin[$i][1]) $hControl = ControlGetHandle($aWin[$i][1],"",15) $aControl = ControlGetPos($aWin[$i][1],"",$hControl) ControlClick($aWin[$i][1],"",$hControl,"left",1,$aControl[2]/2,$aControl[3]/2) Next IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Share this post Link to post Share on other sites
AllEyezOnMe 0 Posted June 21, 2019 3 hours ago, jdelaney said: $bSetupFakeWindows = True If $bSetupFakeWindows Then For $i = 0 To 4 Run("notepad.exe") Next Sleep(1000) $aWin = WinList("[CLASS:Notepad]") For $i = 1 To UBound($aWin)-1 $xRandom = Random(1,800,1) $yRandom = Random(1,800,1) $hRandom = Random(200,500) $wRandom = Random(200,500) WinMove($aWin[$i][1],"",$xRandom,$yRandom,$wRandom,$hRandom) Next EndIf $aWin = WinList("[CLASS:Notepad]") For $i = 1 To UBound($aWin)-1 WinActivate($aWin[$i][1]) $hControl = ControlGetHandle($aWin[$i][1],"",15) $aControl = ControlGetPos($aWin[$i][1],"",$hControl) ControlClick($aWin[$i][1],"",$hControl,"left",1,$aControl[2]/2,$aControl[3]/2) Next that opens notepad and moves from the windows default location as "Random" Share this post Link to post Share on other sites
FrancescoDiMuro 446 Posted June 21, 2019 (edited) @AllEyezOnMe Maybe WinGetClientSize() would help you on what you are trying to do. EDIT: Reading carefully, you better use Control* functions to click something on your script, but we need more than "Notepad", since that's a window, and not a control's name Edited June 21, 2019 by FrancescoDiMuro 1 AllEyezOnMe reacted to this Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Share this post Link to post Share on other sites
AllEyezOnMe 0 Posted June 21, 2019 1 hour ago, FrancescoDiMuro said: @AllEyezOnMe Maybe WinGetClientSize() would help you on what you are trying to do. EDIT: Reading carefully, you better use Control* functions to click something on your script, but we need more than "Notepad", since that's a window, and not a control's name Oh thanks, that's what I've been trying to find Share this post Link to post Share on other sites
FrancescoDiMuro 446 Posted June 21, 2019 @AllEyezOnMe You're welcome 1 AllEyezOnMe reacted to this Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Share this post Link to post Share on other sites
jdelaney 313 Posted June 21, 2019 (edited) 6 hours ago, AllEyezOnMe said: that opens notepad and moves from the windows default location as "Random" ...and then dymamically clicks the center of each randomly sized and placed window based on the control size. How can you have missed the control* functions Edited June 21, 2019 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Share this post Link to post Share on other sites