Sign in to follow this  
Followers 0
flip209

Random lower case letter

12 posts in this topic

I do not know if any would be interested in this but here it is...

CODE
$hex = Random(0x61, 0x7a,1);Pickes a random lower case letter

$hex2 = hex($hex, 2);converts the Decimal to Hex

$hexkey = Chr($hex);coverts the Decimal to Ascii that is the letter

MsgBox(0, ""," Hex: " & $hex2 &" Decimal: "&$hexe & " letter: " & $hexkey)


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites



I have a great idea with this. Create a: CreateSerial() Function like this.

Func CreateSerial($_CharactersInSerial=16, $_IncludeLetters=1, $_IncludeNumbers=1, $_ExtraCharacters="", $_Divide=1, $_DivideEvery_Characters=4)

EndFunc

Info: $_CharactersinSerial, how many characters will be in it. $_IncludeLetters, 1= yes, 0= no. $_IncludeNumbers, 1=yes, 0=no. $_ExtraCharacters, all the extra characters, stringsplit by a "." so if you wanted to add, &^ to it, it would look like this: ^.& . $_Divide, 1=yes, divide the serial with a - , 0=no dont. $_DivideEvery_Characters, this is how many characters you will put a - for.

That would be a cool function to make with that!

Share this post


Link to post
Share on other sites

That would be a good idea see that is why I like this fourm


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites

I do not know if any would be interested in this but here it is...

CODE
$hex = Random(0x61, 0x7a,1);Pickes a random lower case letter

$hex2 = hex($hex, 2);converts the Decimal to Hex

$hexkey = Chr($hex);coverts the Decimal to Ascii that is the letter

MsgBox(0, ""," Hex: " & $hex2 &" Decimal: "&$hexe & " letter: " & $hexkey)

Small, but actually very useful. Saved, because I generally put the entire alphabet in an array, which gets tiring to type out.

For the entire alphabet (Upper and Lower), use this:

$hex = Random(0x61, 0x7a,1);Pickes a random lower case letter

$hex2 = hex($hex, 2);converts the Decimal to Hex

$hexkey = Chr($hex);coverts the Decimal to Ascii that is the letter
Switch Random(1, 2, 1)
    Case 1
        $letter = StringUpper($hexkey)
    Case 2
        $letter = $hexkey
EndSwitch

MsgBox(0, "", $letter)

I know there are more efficient ways of doing it, but... eh... what was I saying?

Share this post


Link to post
Share on other sites

There are actually hex codes that you can pick from... but there is a split of special characters in the middle.


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites

$hex = Random(0x21, 0x7a,1);Pickes a random lower case letter

$hex2 = hex($hex, 2);converts the Decimal to Hex

$hexkey = Chr($hex);coverts the Decimal to Ascii that is the letter

MsgBox(0, ""," Hex: " & $hex2 &" Decimal: "&$hexe & " letter: " & $hexkey)

This does all numbers letters and special characters.


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

uhhh... Just do this

_StringRand(1,0x21,0x7a)

This function has been floating around the forum for a while now

Func _StringRand($length=20,$min=0x20,$max=0x7E)
    $string=''
    For $i=1 To $length
        $string&=Chr(Random($min,$max,1))
    Next
    return $string
EndFunc
Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

That would make one heck of a password generator. :D


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites

That would make one heck of a password generator. :D

I use to generate/sychronize authentication keyfiles for a program I made for myself called "USBLock".

(Locks the computer for input, unlocking only when a specified USB Drive is attached. Once it is attached, the keyfile that was checked to be a match is generated and synchronized again - To prevent multiple 'keys' from being made)


My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I have a great idea with this. Create a: CreateSerial() Function like this.

Func CreateSerial($_CharactersInSerial=16, $_IncludeLetters=1, $_IncludeNumbers=1, $_ExtraCharacters="", $_Divide=1, $_DivideEvery_Characters=4)

EndFunc

Info: $_CharactersinSerial, how many characters will be in it. $_IncludeLetters, 1= yes, 0= no. $_IncludeNumbers, 1=yes, 0=no. $_ExtraCharacters, all the extra characters, stringsplit by a "." so if you wanted to add, &^ to it, it would look like this: ^.& . $_Divide, 1=yes, divide the serial with a - , 0=no dont. $_DivideEvery_Characters, this is how many characters you will put a - for.

That would be a cool function to make with that!

Done! (crosses arms and nods head)

Func _SerialGenerate($length=20, $seplength=4, $sepchar='-', $charset='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
    $charset=StringSplit($charset,'')
    $sepi=1
    $serial=''
    For $i=1 To $length
        $serial&=$charset[Random(1,$charset[0],1)]
        If $sepi=$seplength And $i<$length Then
            $serial&=$sepchar
            $sepi=0
        EndIf
        $sepi+=1
    Next
    Return $serial
EndFunc
Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

#12 ·  Posted

Nicely done....


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

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  
Followers 0