Medic873 0 Posted August 7, 2010 Obviously using the random number system is quite easy. But how can I make it create random words or at least random letters. Thank You Share this post Link to post Share on other sites
Tvern 11 Posted August 7, 2010 Does this help you? The key function to creating a random letter is Chr() you can look it up in the helpfile. Local $aWordList[10] = ["word0","word1","word2","word3","word4","word5","word6","word7","word8","word9"] ConsoleWrite("Capital = " & Chr(Random(65,90,1)) & @CRLF) ConsoleWrite("Lowercase = " & Chr(Random(97,122,1)) & @CRLF) ConsoleWrite("Word = " & $aWordList[Random(0,UBound($aWordList)-1,1)] & @CRLF) Exit Share this post Link to post Share on other sites
seandisanti 6 Posted August 7, 2010 Does this help you? The key function to creating a random letter is Chr() you can look it up in the helpfile. Local $aWordList[10] = ["word0","word1","word2","word3","word4","word5","word6","word7","word8","word9"] ConsoleWrite("Capital = " & Chr(Random(65,90,1)) & @CRLF) ConsoleWrite("Lowercase = " & Chr(Random(97,122,1)) & @CRLF) ConsoleWrite("Word = " & $aWordList[Random(0,UBound($aWordList)-1,1)] & @CRLF) Exit and if you want to make sure that the result is a word, or have a word suggested based on the random letters; you can use word's spellcheck to confirm or get suggestions using com objects. Share this post Link to post Share on other sites
Malkey 231 Posted August 8, 2010 and if you want to make sure that the result is a word, or have a word suggested based on the random letters; you can use word's spellcheck to confirm or get suggestions using com objects. Like this. ; http://www.autoitscript.com/forum/index.php?showtopic=20499&view=findpost&p=141586 Local $sWord, $sRes, $iCount = 0 Local $oWord = ObjCreate("Word.application") While $iCount < 5 For $i = 1 To Random(3, 9, 1) $sWord &= Chr(Random(97, 122, 1)) Next If $oWord.CheckSpelling($sWord) Then $iCount += 1 $sRes &= $iCount & ". Word = " & $sWord & @CRLF ConsoleWrite($iCount & ". Word = " & $sWord & @CRLF) EndIf $sWord = "" WEnd $oWord.quit MsgBox(0, "Results", $sRes) Share this post Link to post Share on other sites
seandisanti 6 Posted August 8, 2010 Like this. ; http://www.autoitscript.com/forum/index.php?showtopic=20499&view=findpost&p=141586 Local $sWord, $sRes, $iCount = 0 Local $oWord = ObjCreate("Word.application") While $iCount < 5 For $i = 1 To Random(3, 9, 1) $sWord &= Chr(Random(97, 122, 1)) Next If $oWord.CheckSpelling($sWord) Then $iCount += 1 $sRes &= $iCount & ". Word = " & $sWord & @CRLF ConsoleWrite($iCount & ". Word = " & $sWord & @CRLF) EndIf $sWord = "" WEnd $oWord.quit MsgBox(0, "Results", $sRes) exactly. i had posted an example somewhere a while ago, but didn't have time to actually write something up today, thanks Share this post Link to post Share on other sites
Medic873 0 Posted August 8, 2010 my only thing is if I ever use this snippet on a computer without word will it work thank you Share this post Link to post Share on other sites
seandisanti 6 Posted August 8, 2010 (edited) my only thing is if I ever use this snippet on a computer without word will it workthank youno, without word installed, word components will most definitely not work***edit***but if it has other office programs like excel etc; you can still use the spell check from objects created from those applications instead. Edited August 8, 2010 by cameronsdad Share this post Link to post Share on other sites
Medic873 0 Posted August 8, 2010 Okay I think I found a better way to randomly generate this thank you Share this post Link to post Share on other sites