Autoit : fonction et while
hexomon
Messages postés
60
Date d'inscription
Statut
Membre
Dernière intervention
-
netsoftnet Messages postés 125 Date d'inscription Statut Membre Dernière intervention -
netsoftnet Messages postés 125 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Je suis en train de me mettre à AutoIt, et j'ai quelques soucis (et oui, des soucis de débutant :) ) . Quand je passe le code ci-dessous, j'ai ma box qui s'affiche, je rentre un un chiffre et là, boum, c'est l'erreur => "unkown function name". Je crois que c'est lié au fait que j'appelle ma fonction QuelChiffre dans un while (elle repond bien quand je la sors du while). Pourriez-vous m'expliquer pourquoi ?
Le code :
Global $sMsg = "hh"
func QuelChiffre ()
;
Select
case $Chiffre_hasard < $Jour
Global $sMsg = "Trop petit"
case $Chiffre_hasard > $Jour
Global $sMsg = "Trop grand"
case $Chiffre_hasard > $Jour
Global $sMsg = "OK"
Return 1
EndSelect
EndFunc
$Chiffre_hasard=Random(1, 10, 1)
$Jour = InputBox("Tuto", "Quel est votre chiffre ?")
while $sMsg <> OK
QuelChiffre ()
MsgBox(0, "Tuto", $sMsg)
WEnd
Merci beaucoup à vous :)
Je suis en train de me mettre à AutoIt, et j'ai quelques soucis (et oui, des soucis de débutant :) ) . Quand je passe le code ci-dessous, j'ai ma box qui s'affiche, je rentre un un chiffre et là, boum, c'est l'erreur => "unkown function name". Je crois que c'est lié au fait que j'appelle ma fonction QuelChiffre dans un while (elle repond bien quand je la sors du while). Pourriez-vous m'expliquer pourquoi ?
Le code :
Global $sMsg = "hh"
func QuelChiffre ()
;
Select
case $Chiffre_hasard < $Jour
Global $sMsg = "Trop petit"
case $Chiffre_hasard > $Jour
Global $sMsg = "Trop grand"
case $Chiffre_hasard > $Jour
Global $sMsg = "OK"
Return 1
EndSelect
EndFunc
$Chiffre_hasard=Random(1, 10, 1)
$Jour = InputBox("Tuto", "Quel est votre chiffre ?")
while $sMsg <> OK
QuelChiffre ()
MsgBox(0, "Tuto", $sMsg)
WEnd
Merci beaucoup à vous :)
A voir également:
- Autoit while 1
- Autoit - Télécharger - Divers Utilitaires
- Application error: a client-side exception has occurred while loading www.leboncoin.fr (see the browser console for more information). - Forum Services en ligne
- Error code 1309 mac while copying ✓ - Forum MacOS
- Accès impossible à mon compte Bon Coin ✓ - Forum Réseaux sociaux
- While fscanf ✓ - Forum C
2 réponses
Salut
Global $s = 1
Func QuelChiffre()
If $Jour= "e" Or $Jour = "E" Then
Exit
ElseIf $Chiffre_hasard > $Jour Then
MsgBox(0,"hexomon Jeux 2015 v1","Trop petit")
ElseIf $Chiffre_hasard < $Jour Then
MsgBox(0,"hexomon Jeux 2015 v1","Trop grand")
ElseIf $Chiffre_hasard = $Jour Then
TrayTip("hexomon Jeux 2015 v1"," B R A V O ",5000)
Beep(Random(500,2000,1),Random(50,500,1))
Beep(Random(500,2000,1),Random(500,1000,1))
$s=1
Sleep(2000)
EndIf
EndFunc
While 1
If $s=1 Then
Global $Chiffre_hasard=Random(1, 10, 1)
Global $s=0
EndIf
Global $Jour = InputBox("hexomon Jeux 2015 v1", "Quel est votre chiffre ? 1 a 10 "&@CRLF&"(Tapper E pour Fermer Le Jeux)")
QuelChiffre ()
WEnd
Bonne Chance :)
Global $s = 1
Func QuelChiffre()
If $Jour= "e" Or $Jour = "E" Then
Exit
ElseIf $Chiffre_hasard > $Jour Then
MsgBox(0,"hexomon Jeux 2015 v1","Trop petit")
ElseIf $Chiffre_hasard < $Jour Then
MsgBox(0,"hexomon Jeux 2015 v1","Trop grand")
ElseIf $Chiffre_hasard = $Jour Then
TrayTip("hexomon Jeux 2015 v1"," B R A V O ",5000)
Beep(Random(500,2000,1),Random(50,500,1))
Beep(Random(500,2000,1),Random(500,1000,1))
$s=1
Sleep(2000)
EndIf
EndFunc
While 1
If $s=1 Then
Global $Chiffre_hasard=Random(1, 10, 1)
Global $s=0
EndIf
Global $Jour = InputBox("hexomon Jeux 2015 v1", "Quel est votre chiffre ? 1 a 10 "&@CRLF&"(Tapper E pour Fermer Le Jeux)")
QuelChiffre ()
WEnd
Bonne Chance :)