michiev Posted September 18, 2012 Share Posted September 18, 2012 I know this is probably confusing but I'll try to explain it, I'm fairly new at using AutoIT and I'm insanely unsure of what I'm doing or what I can do.. So, I would like to be able to have a list of words and be able to run a script that will cycle through those words automatically and stop at a randomized word (The list of words can be numbered as well) Think of it as like pulling a piece of paper out of a hat at random, Thats what I'm trying to do.. Although I have no idea where I would start.. Any advice? Link to comment Share on other sites More sharing options...
JohnOne Posted September 18, 2012 Share Posted September 18, 2012 #include <File.au3> Local $Array _FileReadToArray("list.txt",$Array) MsgBox(0,"Random word",$Array[Random(1,$Array[0],1)]) Make a file called list.txt in script folder. file it with word1 word2 word3 word4 etc... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
michiev Posted September 18, 2012 Author Share Posted September 18, 2012 Thanks for the help, But can you explain more about this "Script" folder? I don't know where thats supposed to be or what. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 18, 2012 Moderators Share Posted September 18, 2012 JohnOne means that you should create the text file in the same folder where your script resides. "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! Link to comment Share on other sites More sharing options...
michiev Posted September 19, 2012 Author Share Posted September 19, 2012 Thanks for the help guys! I've got another question.. I'm trying to get the script to loop through the randomized list.. It pops up a window with "Word1" and I click okay, The windows goes away... I would like to find a way to loop it so it would go through all of the words on the list by popping up each in it's own little popup window until it got to the end of the list. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 19, 2012 Moderators Share Posted September 19, 2012 Hi, michiev. Can you please post the code you have thus far? It will be easier to modify what you have to work the way you want it, rather than trying to write something from scratch to meet your needs. "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! Link to comment Share on other sites More sharing options...
michiev Posted September 19, 2012 Author Share Posted September 19, 2012 Oh dur, I didn't think of posting it until now, I'm sorry Here you go: #include <file.au3> #include <Array.au3> Local $FileArray Local $RandomNumber Local $UsedNumbersArray Local $Counter = 1 _FileReadToArray("list.txt",$FileArray) while ($Counter < $FileArray[0]) $RandomNumber = Random(1, $FileArray[0]) if $RandomNumber not In $UsedNumbersArray Then $Counter = $Counter + 1 MsgBox(0, "Random Word",$FileArray[$RandomNumber]) EndIf WEnd thats the code I have so far. I keep getting errors in the compiler Link to comment Share on other sites More sharing options...
JohnOne Posted September 19, 2012 Share Posted September 19, 2012 (edited) It's erroring because that is not autoit syntax"not in" means nothing to autoit.Read your file into an arrayshuffle the array,you can find a shuffel function by SmOke_NLoop through the resulting array, and output its contents as you do. Edited September 19, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
michiev Posted September 20, 2012 Author Share Posted September 20, 2012 Are there any good guides on auttoarrays/shuffling? Link to comment Share on other sites More sharing options...
JohnOne Posted September 20, 2012 Share Posted September 20, 2012 1. Pass the array to the array shuffle function. 2. The returned array is shuffled. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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