Flickblue Posted September 12, 2022 Posted September 12, 2022 Hello, I´m new to Autoit and Coding is my passion. but currently I´m stuck at this codding to move to further steps: The script run only 4 time from the array list and stop. I want the script to run 4 arrays then repeat again and again Func ssss () For $c = 7 To 1 Step -1 For $i = 1 To 5 Step 1 drop ($i) jump() run() Next Next EndFunc --------------------------------------------------------- Local $arr[4] ; Make room for three elements ;Assign some data $arr[0] = example1 $arr[1] = example2 $arr[2] = example3 $arr[3] = example4 Local $arr1[4] ; Make room for three elements ;Assign some data $arr1[0] = example1 $arr1[1] = "example2 $arr1[2] = example3 $arr1[3] = example4 For $d = 0 To 4 Step 1 MouseClick($MOUSE_CLICK_LEFT, 1196, 53, 1) ClipPut ("google.com") sleep(500) Send("^v") sleep(500) Send("{ENTER}") Sleep(5000) MouseClick($MOUSE_CLICK_LEFT, 1886, 110, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1722, 470, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1886, 110, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 930, 613, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1063, 540, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1018, 657, 1) sleep(500) ClipPut ($arr[$d]) sleep(500) Send("^a") sleep(500) Send("^v") sleep(500) Send("{ENTER}") sleep(500) Send("{ENTER}") sleep(500) ClipPut ($arr1[$d]) sleep(1000) Send("^v") sleep(1000) Send("{ENTER}") sleep(5000) ssss() Next Please help me
Luke94 Posted September 12, 2022 Posted September 12, 2022 This part of your code decides the number of times your script loops. For $d = 0 To 4 Step 1 Once $d = 4, the loop exits. You could increase the number of loops or use a While Loop to create an endless loop. Flickblue 1
Flickblue Posted September 13, 2022 Author Posted September 13, 2022 I increase the $d to 9999 but the array items wont loop from 1-4 and back 1-4 again. There should be an endless command for it.
Moderators JLogan3o13 Posted September 13, 2022 Moderators Posted September 13, 2022 @Flickblue What, exactly, are you attempting to accomplish with this script? There may be a better way to accomplish what you are after. ===For everyone else, please stay out for the moment=== "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Flickblue Posted September 13, 2022 Author Posted September 13, 2022 I run a script and it runs array items 4 times all good but the 5th times it wont run back to $arr[0] = example1. It showed an error that the array numbers exceeded. Therefor I need a clearly command to get it loop endlessly. Thanks for the help
genius257 Posted September 14, 2022 Posted September 14, 2022 (edited) For anyone wondering he wants a repeating loop with two phases. First phase it counts from 0 to 3 second phase it counts from 3 to 0. Hi @Flickblue. The code you gave is pseudo code and won't run, so i modified it a bit for a running example. expandcollapse popup#include <AutoItConstants.au3> Func ssss () For $c = 7 To 1 Step -1 For $i = 1 To 5 Step 1 ;drop ($i) ;jump() ;run() Next Next EndFunc Local $arr[4] ; Make room for three elements ;Assign some data $arr[0] = "example1" $arr[1] = "example2" $arr[2] = "example3" $arr[3] = "example4" Local $arr1[4] ; Make room for three elements ;Assign some data $arr1[0] = "example1" $arr1[1] = "example2" $arr1[2] = "example3" $arr1[3] = "example4" $i = 0 $j = +1 While 1 MouseClick($MOUSE_CLICK_LEFT, 1196, 53, 1) ClipPut ("google.com") sleep(500) Send("^v") sleep(500) Send("{ENTER}") Sleep(5000) MouseClick($MOUSE_CLICK_LEFT, 1886, 110, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1722, 470, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1886, 110, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 930, 613, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1063, 540, 1) sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 1018, 657, 1) sleep(500) ClipPut ($arr[$i]) sleep(500) Send("^a") sleep(500) Send("^v") sleep(500) Send("{ENTER}") sleep(500) Send("{ENTER}") sleep(500) ClipPut ($arr1[$i]) sleep(1000) Send("^v") sleep(1000) Send("{ENTER}") sleep(5000) ssss() If $i = 0 Then $j = +1 ElseIf $i = 3 Then $j = -1 EndIf $i += $j WEnd Be aware there is no code to stop the script currently. Edited September 14, 2022 by genius257 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
Flickblue Posted September 14, 2022 Author Posted September 14, 2022 Hello, Thanks for the reply. Actually I mentioned false. I want it run like this; 1,2,3,4,1,2,3,4,1,2,3,4,etc... and endlessly without stop. I hope its clearly now
Moderators JLogan3o13 Posted September 14, 2022 Moderators Posted September 14, 2022 9 hours ago, genius257 said: For anyone wondering he wants a repeating loop with two phases. First phase it counts from 0 to 3 second phase it counts from 3 to 0. Exactly what part of Stay Out did you not understand? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Moderators JLogan3o13 Posted September 14, 2022 Moderators Posted September 14, 2022 @Flickblue You did not answer my previous question. What is the intent of your script, or what are you trying to accomplish (the application you're automating, the website, etc.)? =================Hopefully much more plaint this time - Everyone else please stay out while a Mod is determining legitimacy of the post================= "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Flickblue Posted September 15, 2022 Author Posted September 15, 2022 @JLogan3o13 I m doing a script to switch google account automated.
Developers Jos Posted September 15, 2022 Developers Posted September 15, 2022 1 hour ago, Flickblue said: I m doing a script to switch google account automated. Please try again and this time be a little bit more serious with your answer taking into account you are dealing with intelligent humans. 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.
Moderators JLogan3o13 Posted September 15, 2022 Moderators Posted September 15, 2022 @Flickbluelet's try this another way. Your script looks very much like you are automating a game. This thread is locked until you A: Familiarize yourself with the forum rules. If you want to PM me and convince me this is not for a game, we'll talk about unlocking it. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts