xkazz Posted July 23, 2021 Share Posted July 23, 2021 Hey guys, I struggled last few days because of ControlClick didn't work for me so I tried with MouseClick. I wrote a script that checks if a program is open, if it's not, it opens it. If it's open it uses activate window (because mouseclick doesn't work without it I don't know why) then it click where I want it to. The problem is, if the program isn't open, it opens it without issues but it doesn't click anywhere on the screen. If the program is open, it does click the right way. Where is the issue of mouseclick not working without activate window ? and the issue of mouseclick not executing if the script doesn't find the program at first and opens it ? Link to comment Share on other sites More sharing options...
Danp2 Posted July 23, 2021 Share Posted July 23, 2021 Clearly the issue is on line 9 of your script. 🙄 Seriously, post the script if you want real help. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted July 23, 2021 Share Posted July 23, 2021 Line 9 ? My line ? Man, you are good ! Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
xkazz Posted July 23, 2021 Author Share Posted July 23, 2021 Sorry I'm not used to it. $variable1= TimerInit() $checkWin = WinExists("Internet Download Manager 6.36") Sleep(2000) If $checkWin = 0 Then ShellExecute("Internet Download Manager" , "", @DesktopDir) Sleep(8000) ElseIf $checkWin = 1 Then sleep(3000) WinActivate("Internet Download Manager") MouseClick("left" , 680, 457, 1) Sleep(1000) MouseClick("left" , 1169, 55, 1) EndIf $variable2= TimerDiff($variable1) MsgBox(0, "lesson 3", "beinning time: " & $variable1 & @CRLF & "total time " & $variable2) If I remove the WinActivate("Internet Download Manager") it won't click even if idm is open it won't click if idm isn't open even after it opens it Link to comment Share on other sites More sharing options...
SkysLastChance Posted July 23, 2021 Share Posted July 23, 2021 (edited) The way you have your code written it will only do one of the two things NOT both It will either: 1. "If statement" Open Internet Download Manger if not open 2. "ElseIf Statement" If it is already open it will click the mouse in the selected coordinates. Then if gives you the TimerDiff () If I am understanding correctly. You want it to click whether Internet Download Manger was already open or not. If that is the case you don't need the ElseIf $variable1= TimerInit() $checkWin = WinExists("Internet Download Manager 6.36") Sleep(2000) If $checkWin = 0 Then Msgbox(0,"","If Statment") ;;ShellExecute("Internet Download Manager" , "", @DesktopDir) ;;Sleep(8000) ElseIf $checkWin = 1 Then Msgbox(0,"","ElseIf Statment") ;;Sleep(3000) ;;WinActivate("Internet Download Manager") ;; MouseClick("left" , 680, 457, 1) ;;Sleep(1000) ;;MouseClick("left" , 1169, 55, 1) EndIf Msgbox(0,"","On to the next line") $variable2= TimerDiff($variable1) MsgBox(0, "lesson 3" ,"beinning time: " & $variable1 & @CRLF & "total time " & $variable2) Try running this code with download manager open and then again with download manager closed. You should get the idea. Notice if you run this you will only get either the If statement msgbox or the ElseIF statement msgbox. Not both Edited July 23, 2021 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
xkazz Posted July 23, 2021 Author Share Posted July 23, 2021 1 minute ago, SkysLastChance said: The way you have your code written it will only do one of the two things NOT both It will either: 1. "If statement" Open Internet Download Manger if not open 2. "ElseIf Statement" If it is already open it will move the mouse. Then if gives you the TimerDiff () If I am understanding correctly. You want it to click whether Internet Download Manger was already open or not. If that is the case you don't need the ElseIf $variable1= TimerInit() $checkWin = WinExists("Internet Download Manager 6.36") Sleep(2000) If $checkWin = 0 Then Msgbox(0,"","If Statment") ;;ShellExecute("Internet Download Manager" , "", @DesktopDir) ;;Sleep(8000) ElseIf $checkWin = 1 Then Msgbox(0,"","ElseIf Statment") ;;Sleep(3000) ;;WinActivate("Internet Download Manager") ;; MouseClick("left" , 680, 457, 1) ;;Sleep(1000) ;;MouseClick("left" , 1169, 55, 1) EndIf Msgbox(0,"","On ot the next line") $variable2= TimerDiff($variable1) MsgBox(0, "lesson 3" ,"beinning time: " & $variable1 & @CRLF & "total time " & $variable2) Notice if you run this you will only get either the If statement msgbox the Else IF msg box. Not both Thank you for the answer. I want to check if IDM is open. If it's not then I want it to start. If it is, I want it to click on a certain pixel. So the overall goal is to open IDM and click on a certain pixel, if it's open then I only want to click a certain pixel. 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