This script checks that: The version string is at least 3 characters long. The version string is not blank. The version contains a period. The characters before . Are digits. All characters except possibly the last are digits or a period. The last character after . is a digit or a letter.(digit at last of number) If conditions are not working in the problem
${If} $sVersion == ""
MessageBox MB_OK "You can't leave Version blank"
Abort
${EndIf}
StrCpy $R1 $sVersion
Strlen $R2 $R1
${If} $R2 < 3
MessageBox MB_OK "Version must be atleast 3 characters long including a period ."
Abort
${EndIf}
${StrContains} $R0 $R1 "."
${If} $R0 == -1
MessageBox MB_OK "Version must contain a digit"
Abort
${EndIf}
StrCpy $R3 0
loop:
StrCpy $R4 $R1 1 $R3
${If} $R4 == "."
Goto checkLastChar
${EndIf}
${If} $R4 < "0"
${OrIf} $R4 > "9"
MessageBox MB_OK "All Characters Before the Period . must be a digit"
Abort
${EndIf}
IntOp $R3 $R3 + 1
StrCmp $R3 $R0 loop
checkLastChar:
StrCpy $R5 $R1 1 $R2
${If} $R5 < "0"
${OrIf} $R5 > "9"
${AndIf} $R5 < "a"
${OrIf} $R5 > "z"
${AndIf} $R5 < "A"
${OrIf} $R5 > "Z"
MessageBox MB_OK "The last character must be a digit or a letter"
Abort
${EndIf}
end_loop:
FunctionEnd