Jump to content
Sign in to follow this  

StringLen Acting Wierd

Recommended Posts


$Len = StringLen($Result)
    If $Len < 8 Then
        $digits = 8 - $Len
        For $i = 1 To $digits
            $aSpace[0] = Chr(Random(97, 122, 1)) ;a-z
            $aSpace[1] = Chr(Random(48, 57, 1)) ;0-9
            $aSpace[2] = Chr(Random(65, 90, 1)) ;A-Z
            $Adder &= $aSpace[Random(0, 3)]
        $Result = $Result & $Adder
    Return $Result
EndFunc   ;==>_Password

I suspected that my StringLen wasn't working as it should so I debugged it with a Msgbox. The strange thing is:

1. The msgbox pops up two times. Once with $Len as 0, the second time with $Len as the real stringlength of $Result.

What causes this "loop"? Why is $Len 0 the first time?

Share this post

Link to post
Share on other sites

Odd function start code you got there.

$Len = StringLen($Result)
EndFunc   ;==>_Password

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

Share this post

Link to post
Share on other sites

Maybe length was really equal to 0 at that point, and its likely you have another MsgBox(), hard to help with so little code.

More code=More help :)

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.