Medic873 Posted August 7, 2010 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
Tvern Posted August 7, 2010 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
seandisanti Posted August 7, 2010 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.
Malkey Posted August 8, 2010 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)
seandisanti Posted August 8, 2010 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
Medic873 Posted August 8, 2010 Author Posted August 8, 2010 my only thing is if I ever use this snippet on a computer without word will it work thank you
seandisanti Posted August 8, 2010 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
Medic873 Posted August 8, 2010 Author Posted August 8, 2010 Okay I think I found a better way to randomly generate this thank you
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