VasileVetisan Posted February 13, 2013 Share Posted February 13, 2013 (edited) Hi, I want to make an monkey testing for a website, and I am stuck at extracting Random elements from an array I tried the code on a word document ant the only character that was printed was "$". I want to help me to sent the values of the array elements to screen expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: Vasile Script Function: Monkey. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Run("C:\Program Files\Google\Chrome\Application\chrome.exe http://quiz.interhit.net/");deschide chrome--si site QUIZ Sleep(200);asteapta 200 de milisecunde apoi ;~ SE DA CLICK PE BUTONUL "INCEPE QUIZ" $activ_x = 676 $activ_y = 569 $repetari = 0 Do Local $array[27] $array[0]="F5" $array[1]="F1" $array[3]="F12" $array[4]="¬" $array[5]="1" $array[6]="10" $array[7]="-" $array[8]="=" $array[9]="+" $array[10]="TAB" $array[11]="SPACE" $array[12]="LWIN"; WINDOWS KWY $array[13]="CAPSLOCK" $array[14]="LALT";ALT KEY $array[15]="Enter" $array[16]="ESC" $array[17]="DELETE" $array[18]="BACKSPACE" $array[19]="SCROLLLOCK" $array[20]="LSHIFT" $array[21]="A" $array[22]="Z" $array[23]="a" $array[24]="z" $array[25]="1" $array[26]="10" $x = Random(10, 1000, 1) $y = Random(10, 700, 1) $chr = Random(0,27,1) Local $i = 0 While $i<= 3 MouseClick("left", $y, $x) Send("{$array[$chr]}") $i = $i + 1 WEnd $repetari= $repetari + 1 Until $repetari = 1000000 ps:SORRY ABOUT SOME COMMENTS THEY ARE IN ROUMANIAN, MY NATIVE LANGUAGE--> COMMENTS ARE NOT IMPORTANT Edited February 13, 2013 by VasileVetisan Link to comment Share on other sites More sharing options...
VasileVetisan Posted February 13, 2013 Author Share Posted February 13, 2013 While $i<= 3 MouseClick("left", $y, $x) Send("{" & $array[$chr] & "}"=) $i = $i + 1 WEnd Link to comment Share on other sites More sharing options...
armoros Posted February 13, 2013 Share Posted February 13, 2013 It looks like you're missing a bracket in your Send call. Try: Send("{$array[$chr]}") However, I think it would be perfered if you surrounded the special cases with brackets instead. IE: $array[0] = "{F5}" $array[1] = "{F1}" .... $array[21] = "A" $array[22] = "Z" .... Send("$array[$chr]") [font="verdana, geneva, sans-serif"] [/font] 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