CrvzLee Posted July 13, 2016 Share Posted July 13, 2016 Hi, The following is my script for auto clicking within a program call Wnd. With this codes, the control click function still runs although the program Wnd is in the background. Dim $On Dim $handle = WinGetHandle("Wnd") While 1 While $On = True ControlClick( $handle, "", "" ,"left" , 1 , 441 , 106 ) Sleep(800) ControlClick( $handle, "", "" ,"left" , 1 , 441 , 106 ) Sleep(5000) WEnd Sleep(100) WEnd I wanted to add a mouse drag function but it doesn't work within the program. I tried MouseClickDrag and it targes my whole monitor screen. May I ask for guidance on how to use MouseClickDrag within the program Wnd only? Thank you very much. Link to comment Share on other sites More sharing options...
AutoBert Posted July 13, 2016 Share Posted July 13, 2016 That's easy just exit the inner loop when window is not active: Dim $On Dim $handle = WinGetHandle("Wnd") While 1 While $On = True If Not WinActive($handle) Then ExitLoop ControlClick($handle, "", "", "left", 1, 441, 106) Sleep(800) ControlClick($handle, "", "", "left", 1, 441, 106) Sleep(5000) WEnd Sleep(100) WEnd Link to comment Share on other sites More sharing options...
CrvzLee Posted July 13, 2016 Author Share Posted July 13, 2016 1 hour ago, AutoBert said: That's easy just exit the inner loop when window is not active: Dim $On Dim $handle = WinGetHandle("Wnd") While 1 While $On = True If Not WinActive($handle) Then ExitLoop ControlClick($handle, "", "", "left", 1, 441, 106) Sleep(800) ControlClick($handle, "", "", "left", 1, 441, 106) Sleep(5000) WEnd Sleep(100) WEnd Hello, Thank you very much for your reply. However, as i have tested, the controlclick from the original codes can be use even when the window is in the background. However, the ControlClick does not make the mouse cursor drag. Is there any other way that you can advise besides the Control Click to achieve the mouse drag behavior? Thank you very much for your kind response. Link to comment Share on other sites More sharing options...
water Posted July 13, 2016 Share Posted July 13, 2016 Why would you need a mouse drag behavior on a background window? What do you expect the mouse in the foreground window to do then? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
CrvzLee Posted July 13, 2016 Author Share Posted July 13, 2016 the reason is so that I can still use my monitor for something else while the sequence is running. Anyway, i got it sorted out already. Thank you very much for your help. Link to comment Share on other sites More sharing options...
water Posted July 13, 2016 Share Posted July 13, 2016 Would you please be so kind to post your solution so it might be useful for other users in the future? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted July 13, 2016 Share Posted July 13, 2016 Yes, I have never seen a solution for that "ControlClickDrag" AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
CrvzLee Posted July 13, 2016 Author Share Posted July 13, 2016 Hi, to be honest, It's not as fantastic as what you all think. Is just that i sacrifice my screen while letting the sequence run. That's all. But I'm quite curious, is there a limitation to Windows Operating System that there wasn't a "ControlClickDrag" programmed in AutoIT? Link to comment Share on other sites More sharing options...
CrvzLee Posted July 13, 2016 Author Share Posted July 13, 2016 9 minutes ago, CrvzLee said: Apology for the double reply as i could not find the edit button. in my research, i found something like this https://www.autoitscript.com/forum/topic/147988-controlclick-down-and-up/ but i couldnt get it incorporated to my sequence. So i end up giving up. and something call ControlMove (https://www.autoitscript.com/autoit3/docs/functions/ControlMove.htm) which i can't seem to get it to work. Any advise? 9 minutes ago, CrvzLee said: Link to comment Share on other sites More sharing options...
JohnOne Posted July 13, 2016 Share Posted July 13, 2016 Thing is, you don't say exactly what it is you are trying to accomplish with a pseudo ControlClickDrag. It could help with a suggestion for another path to take. There is not one in autoit because it cannot be accomplished with the windows api. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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