Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Help to find a way to verify the correct answer

$
0
0
Hello,

in the future i will use inputbox but for now is just for testing.

I'am trying to find a way to make to verify the correct answer for the input box, so if one  the inputbox doesn't met the requirement it will ask to reconfigure, and wont continue the script.

the way i found to control the inputbox work fine if only one email is field,
but i decide to allow more them on email .
so i begin to find a way to  make the control to work but using this way wont work

so i'am asking for some ideas for make the control  to work. because i doesn't  find a solution
sorry for bad English
Thanks

#include <String.au3>
#include <Misc.au3>
#include <File.au3>
#include <Array.au3>

$urNome = ""  ; inbox 1 put a name
$urNomePst = "" ; inbox 2 put filename
$urTam = "" ; inbox 3 put the lim size
$urEmail = "raffav@msn.com;raffaello@msn.com;raffavgmail.com" ; inbox 4 put the email  use ; to put more than one email

$uverifc = ""

#region ### VERIFICA NOME ############################ (Usuario)
If $urNome = "" Then ; check if the name is blank
MsgBox(0, "Error", "Insira Um Nome de usuario Valido") ;error msg

$uverifc = $uverifc + 3 ; add  + 3 to the control

ElseIf StringLen($urNome) <= 3 Then ; check if the name have less them 3 char
MsgBox(16, "Erro", "Favor inserir um nome maior do que 3 carecter")
$uverifc = $uverifc + 3 ; add  + 3 to the control

Else

;if is corrent than set the controll to + 2

MsgBox(0, "ok 1", "OK 1")

$uverifc = $uverifc + 2 ; add  + 2 to the control
EndIf

#endregion ### VERIFICA NOME ############################ (Usuario)
#region ### VERIFICA NOME PST ############################ (Usuario)
If $urNomePst = "" Then

MsgBox(0, "Error", "Insira Um Nome de Pst Valido")
$uverifc = $uverifc + 3

Else

$urNomePst = $urNomePst

$size = FileGetSize($urNomePst)
If $size = 0 Then
MsgBox(16, "FILESIZE", "Nome da pst: " & '"' & $urNomePst & '"' & "Não encontrado, Favor especificar o nome correto")
$uverifc = $uverifc + 3
Else
MsgBox(0, "ok 2", "OK 2")
$uverifc = $uverifc + 2
EndIf
EndIf

#endregion ### VERIFICA NOME PST ############################ (Usuario)
#region ### VERIFICA TAMANHO PST ############################ (Usuario)
$nun = StringRegExp($urTam, "^[0-9.]+$")
If $urTam = "" Then
MsgBox(0, "Error", "Insira Um Tamanho Valido")
$uverifc = $uverifc + 3
ElseIf $nun = 0 Then
MsgBox(16, "Erro", " Erro no 3° Parametro: " & '=>"' & $urTam & '"<=' & @CRLF & "Somente Numeros e Pontos(.)")
$uverifc = $uverifc + 3
ElseIf $urTam < 5 Or $urTam > 15 Then
MsgBox(64, "Erro", "Favor use um valor entre 5 - 15 GB")
$uverifc = $uverifc + 3
Else
MsgBox(0, "ok 3", "OK 3")
$uverifc = $uverifc + 2
EndIf
#endregion ### VERIFICA TAMANHO PST ############################ (Usuario)
#region ### VERIFICA EMAIL DE ENVIO ############################ (Usuario)

Global $To_array = StringSplit($urEmail, ";")
Global $e_un[$To_array[0] + 1][2] = [[$To_array[0], 0]]
For $s = 1 To UBound($To_array) - 1
If Not StringRegExp($To_array[$s], "^[a-z0-9._%-]+@[a-z0-9].+[*]{0,4}[a-z]{2,4}+$") Then
$e_un[$s][0] = $To_array[$s]

MsgBox(16, "Error", $e_un[$s][0] & " Não é Valido " & @CRLF & " Insira Um E-mail de envio Valido")

$e_un[$s][1] = 2
$uverifc = $uverifc + 3

Else

MsgBox(0, "ok 4", "OK 4")

$uverifc = $uverifc + 2

$e_un[$s][0] = $To_array[$s]
$e_un[$s][1] = 1

EndIf

Next
For $s = 1 To UBound($To_array) - 1;
MsgBox(0, "ver", $e_un[$s][1] & " " & $e_un[$s][0])
Next
#endregion ### VERIFICA EMAIL DE ENVIO ############################ (Usuario)

;this here only will work if the email is only one, because if ther more then 2 correct email the $uverifc used for verify the answer will pass the correct answer below and will always sai that is not ok

If $uverifc <> 8 Then
MsgBox(0, "Error", "reconfigure " & $uverifc) ; all, or one of them don't met the  requeriment.
ElseIf $uverifc == 8 Then
MsgBox(0, "ok 5", "Configuração Ok") ;all is ok so can continue the script 
EndIf


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>