CrvzLee Posted July 13, 2016 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.
AutoBert Posted July 13, 2016 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
CrvzLee Posted July 13, 2016 Author Posted July 13, 2016 On 7/13/2016 at 12:29 PM, 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 Expand 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.
water Posted July 13, 2016 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: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
CrvzLee Posted July 13, 2016 Author 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.
water Posted July 13, 2016 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: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
JohnOne Posted July 13, 2016 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.
CrvzLee Posted July 13, 2016 Author 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?
CrvzLee Posted July 13, 2016 Author Posted July 13, 2016 On 7/13/2016 at 5:40 PM, 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. Expand 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: Expand
JohnOne Posted July 13, 2016 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.
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