[R] Func pas très correct (RandomLettre)

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Répondre
alex1205
Niveau 5
Niveau 5
Messages : 123
Enregistré le : dim. 07 mars 2010 13:59
Status : Hors ligne

[R] Func pas très correct (RandomLettre)

#1

Message par alex1205 »

Bonjour, travaillant plusieurs jours pour mettre au point une func qui ne marche pas. :(
La fonction de RandomLettre
Code de la fonction:

Code : Tout sélectionner

Func RandomLettre ($minimal, $maximal) ;$minimal et $maximal doit etre le nombre qui represente la lettre (A=1, B=2, C=3 ...)
    $lettre=Random ($minimal, $maximal, 1)
    If $lettre = "1"  Then
        RandomLettre = "a"
    ElseIf $lettre = "2"  Then
        RandomLettre = "b"
    ElseIf $lettre = "3" Then
        RandomLettre = "c"  
    ElseIf $lettre = "4"  Then
        RandomLettre = "d"  
    ElseIf $lettre = "5" Then
        RandomLettre = "e"
    ElseIf $lettre = "6" Then
        RandomLettre = "f"
    ElseIf $lettre = "7" Then
        RandomLettre = "g"  
    ElseIf $lettre = "8" Then
        RandomLettre = "h"  
    ElseIf $lettre = "9" Then
        RandomLettre = "i"  
    ElseIf $lettre = "10" Then
        RandomLettre = "j"  
    ElseIf $lettre = "11 Then
        RandomLettre = "k"  
    ElseIf $lettre = "12" Then
        RandomLettre = "l"  
    ElseIf $lettre = "13 Then
        RandomLettre = "m"  
    ElseIf $lettre = "14" Then
        RandomLettre = "n"  
    ElseIf $lettre = "15" Then
        RandomLettre = "o"  
    ElseIf $lettre = "16" Then
        RandomLettre = "p"  
    ElseIf $lettre = "17" Then
        RandomLettre = "q"  
    ElseIf $lettre = "18" Then
        RandomLettre = "r" 
    ElseIf $lettre = "19" Then
        RandomLettre = "s"  
    ElseIf $lettre = "20" Then
        RandomLettre = "t"  
    ElseIf $lettre = "21" Then
        RandomLettre = "u"  
    ElseIf $lettre = "22" Then
        RandomLettre = "v"  
    ElseIf $lettre = "23" Then
        RandomLettre = "w"  
    ElseIf $lettre = "24" Then
        RandomLettre = "x"  
    ElseIf $lettre = "25" Then
        RandomLettre = "y"  
    ElseIf $lettre = "26" Then
        RandomLettre = "z"      
    EndIf
EndFunc
 
Merci à l'avance
Alex1205
Modifié en dernier par alex1205 le ven. 16 avr. 2010 14:54, modifié 1 fois.
Le "je ne sais pas" et "j'y arrive pas" n'existe dans mon vocabulaire. Toutes Questions ont une réponse, cherchez et vous la trouverai. Utilisez Recherche du forum et vous verrez. Si [blink]Aucune[/blink] question ne tient à votre problème, créez un sujet.
GMib
Niveau 4
Niveau 4
Messages : 57
Enregistré le : sam. 23 janv. 2010 12:39
Status : Hors ligne

Re: [..] Func pas très correct (RandomLettre

#2

Message par GMib »

Essaye ceci :

Code : Tout sélectionner

$RandomLettre = RandomLettre("a","z")
MsgBox(0, '', $RandomLettre)

Func RandomLettre ($minimal, $maximal)
  $lettre=Chr(Random (Asc($minimal), Asc($maximal), 1))
  Return $lettre
EndFunc
Répondre