User Controls

Whoever designed AutoIT should be shot in the face.

  1. #1
    Sophie Pedophile Tech Support
    Traversing the intertubes i found a post by someone who had made a pseudorandom string generator in AutoIT. Here's what it looks like.



    Func _pGenerate($sLen)
    Local $aCharset = StringSplit("0123456789!@#$%^&*-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "")
    Local $sRand = 0, $sDupCheck = 0, $sReturn = ""

    For $i = 1 to $sLen
    $sRand = Round(Random(1, $aCharset[0], 1))
    if $sRand < ($sDupCheck - 4) OR $sRand > ($sDupCheck + 4) Then
    $sReturn &= $aCharset[$sRand]
    $sDupCheck = $sRand
    Else
    $i -= 1
    EndIf
    Next

    Return $sReturn
    EndFunc ;==> _pGenerate()


    Look at this monstrosity and what's up with all the silly dollar signs anyway? Besides i don't know if the guy messed his syntax up or this is actually how you do it but the else in his if/else statement is capitalized while the if is not (-_-")

    From the top of my head, python does this in 3 lines of code and that's including import statements.


    import random, string

    def string_generator(length=10,chars=string.ascii_uppercase + string.ascii_lowercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(length)


    Now if you will excuse me i have to scrub the filth that is AutoIT syntax from my retinas.
Jump to Top