I'm trying to solve a quite common problem - validating the input to be a positive integer greater 1. What I've tried so far works as long as the input is not in science notation.
I searched quite long on SO for solution but didn't find any for this specific case. So this is my current code:
If IsNumeric(objArgs(1)) Then
If CLng(objArgs(1)) = objArgs(1) Then
if(objArgs(1) < 1) then
wscript.echo "2nd parameter must be greater than 1"
else
' move on
end if
else
wscript.echo "2nd parameter is not an integer"
end if
else
wscript.echo "2nd parameter is not numeric"
end if
This works fine when the input is something like a, 0, -10, 3.14 and so on.
My problem occures when I enter a (large) number in science notation, like 1E+48. If I enter this I get a overflow-error on the CLng()-function.
How can I avoid this?