AllEyezOnMe Posted June 20, 2019 Share 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! Link to comment Share on other sites More sharing options...
Developers Jos Posted June 20, 2019 Developers Share 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. Link to comment Share on other sites More sharing options...
iuc73663 Posted June 20, 2019 Share 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. Link to comment Share on other sites More sharing options...
AllEyezOnMe Posted June 21, 2019 Author Share 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 Link to comment Share on other sites More sharing options...
jdelaney Posted June 21, 2019 Share 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. Link to comment Share on other sites More sharing options...
AllEyezOnMe Posted June 21, 2019 Author Share 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" Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted June 21, 2019 Share 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 AllEyezOnMe 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
AllEyezOnMe Posted June 21, 2019 Author Share 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 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted June 21, 2019 Share Posted June 21, 2019 @AllEyezOnMe You're welcome AllEyezOnMe 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
jdelaney Posted June 21, 2019 Share 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. 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