stallion Posted January 7, 2014 Share Posted January 7, 2014 (edited) What wrong with my script that the for next loop count a wrong number?? When I input 10 times to execute the for next loop, the program execute only 5 times. The script list as below. thanks. PS: the program execute correct sometimes but not always. expandcollapse popupClickTheMouse1() Func ClickTheMouse1() $time2send = InputBox("Set the number of seconds "," Enter the number of seconds, which can be a decimal point? Mouse over the left-most screen, you can exit the program", "") * 1000 ; Second input box $num2send = InputBox("Set the number of connect the dots "," Input number must be greater than 1? Mouse over the left-most screen, you can exit the program", "") ;mouse click execute times input box If $time2send < 0.4 Then $time2send = 1.5 * 1000 EndIf If $num2send < 1 Then $num2send = 10 EndIf MsgBox(4096, "Mouse ready press OK "," every " & $time2send / 1000 & " seconds of pressing " & $num2send & " times, move the mouse to the position, ready to press the OK") ; Show the message what the data is about user input. $pos = MouseGetPos() $x = $pos[0] $y = $pos[1] ; get the mouse position. $iCount = 0 ; @@ for next loop, some problem in there. For $i = 1 To $num2send Step 1 If $pos[0] = 0 Then ExitLoop EndIf $iCount += 1 ConsoleWrite($iCount & " - ") If $time2send = 2500 Then ;MouseClick("Left") ConsoleWrite("Click left" & @CRLF) Else ;MouseClick("Left", $x, $y) ConsoleWrite("Click left at pos" & @CRLF) EndIf Sleep($time2send) ;sleep $pos = MouseGetPos() Next EndFunc ;==>ClickTheMouse1 Edited January 7, 2014 by Melba23 Added code tags and translated Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 7, 2014 Moderators Share Posted January 7, 2014 stallion,Welcome to the AutoIt forum. Your loop runs 10 times when I set that value. Why do you think it does not? M23P.S. When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
stallion Posted January 8, 2014 Author Share Posted January 8, 2014 I found the reason. I use the ToolTip("Count down! " & $i, $x, $y) to debug the program. The web site that I want to use Autoit on it dose not reflect the mouse click below 1.5 second. Thanks. 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