pezo89 Posted May 23, 2009 Share Posted May 23, 2009 Hey guys, i where just wondering how i can randomly choose from a preset list of words to type.. for example send ("Yes") send ("no") send ("mabye" )send ("perhaps") send ("help me") well, in general how to have a diffrent sentence typed down each time.. Link to comment Share on other sites More sharing options...
pezo89 Posted May 23, 2009 Author Share Posted May 23, 2009 Put your strings into an array, chose one randomly, and send it. Here's an example that uses a Message Box instead of Send(). Local $string[5] = ["Yes", "No", "Maybe", "Perhaps", "Help me"] Local $X = Random(0,4,1) MsgBox(0,"Test",$string[$X]) so $string[5] is the number of answers? (for example 10 answers = $string[10] and Random(0,9,1)? and this works under a while 1 loop, thats activated upon a pixel search? Link to comment Share on other sites More sharing options...
pezo89 Posted May 23, 2009 Author Share Posted May 23, 2009 Yes, that's right.Yes, it should work anywhere.ok, thx alot for ur time, and help =) Link to comment Share on other sites More sharing options...
herewasplato Posted May 23, 2009 Share Posted May 23, 2009 (edited) so $string[5] is the number of answers? (for example 10 answers = $string[10] and Random(0,9,1)?If you will use StringSplit, you will not have to think about such things :-) You can just add more things to the string of answers and StringSplit will make the array. StringSplit turns this: "Yes,No,Maybe,Perhaps,Help me" into this $a_answers [0] = 5 <<< contains the number of strings returned. $a_answers [1] = Yes $a_answers [2] = No $a_answers [3] = Maybe $a_answers [4] = Perhaps $a_answers [5] = Help me $a_answers = StringSplit("Yes,No,Maybe,Perhaps,Help me", ",") While 1 $i_var = Random(1, $a_answers[0], 1) MsgBox(0, $i_var, $a_answers[$i_var], 1) WEndSo run this code and you should be able to figure out what each line does - if not, post back or PM me. ... and this works under a while 1 loop, thats activated upon a pixel search?And where is your code to show what you have tried??? :-) Edited May 23, 2009 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
pezo89 Posted May 23, 2009 Author Share Posted May 23, 2009 i dont got a clue what im trying to do, anyhow, here is the code expandcollapse popup;test; Global $Paused sleep ("1000") HotKeySet("{Pause}", "TogglePause") HotKeySet("{Insert}", "Terminate") sleep ("2000") send ("{Pause}") while 1 toolTip('Script - "Scriptet er - PÅ"',0, 40) $pixelSearch=PixelSearch(412, 269, 1005, 769, 0XFFEB75) sleep (2000) MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) sleep (5000) If IsArray($pixelSearch)=1 Then;If the pixel color has been found then $pixelSearch=PixelSearch(412, 269, 1005, 769, 0XFFEB75) sleep (2000) MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5) sleep (5000) sleep (100) Send("{Tab}") sleep (100) sleep (2000) send (" xxxxxxxxxxxxxxxxxxxxxxxx");;<<<<----- This is where i need it to type in the random Answer (Pref 10x diffrent answers) sleep (2000) Send("{Shiftdown}") sleep (3000) Send("{Tab}") sleep (100) Send("{Tab}") sleep (100) Send("{Tab}") sleep (100) Send("{shiftup}") sleep (1000) send ("{Space}") sleep (10000) EndIf WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) toolTip('Script - "Scriptet er - AV"',0, 40) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc The script itself works like a charm, just not the random part Link to comment Share on other sites More sharing options...
herewasplato Posted May 23, 2009 Share Posted May 23, 2009 (edited) ~~~~~~~~sleep ("2000") send ("{Pause}")$a_answers = StringSplit("Yes,No,Maybe,Perhaps,Help me", ",")while 1 ~~~~~~~~ ~~~~~~~~ Send("{Tab}") sleep (100) sleep (2000)send (" xxxxxxxxxxxxxxxxxxxxxxxx");$i_var = Random(1, $a_answers[0], 1)Send($a_answers[$i_var]) sleep (2000) Send("{Shiftdown}") ~~~~~~~~Can you edit (add to) the list of answers?Edit: ^^^ not meant as an insult, just a question. Edited May 23, 2009 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] 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