ajtsystems
IS-IT--Management
Hi I have a Sub which checks the validity of a textbox input.
The textbox takes an ip address feed and if cancel is pressed the script will quit.
sub EnterIP
'textbox for entering value
IPAddress = inputbox( "Please Enter IP Address:" )
'Username = inputbox( "username:" )
'password = inputbox( "password:" )
'validation of textbox input
'if not a numeric value
If Not IsNumeric (IPAddress) Then
wscript.echo "This needs to be an IP address like 1.1.1.1"
call enterip
else
'if cancel is pressed
if IPAddress = "" then
wscript.quit
end if
end if
End Sub
The problem I have is that the IsNumeric function is incorrect for an ip addres function, presumably because it has '.' in.
Does anyone know how or if there is a function for an IP address format. I though maybe using regular expressions and the instr function...
#thanks
The textbox takes an ip address feed and if cancel is pressed the script will quit.
sub EnterIP
'textbox for entering value
IPAddress = inputbox( "Please Enter IP Address:" )
'Username = inputbox( "username:" )
'password = inputbox( "password:" )
'validation of textbox input
'if not a numeric value
If Not IsNumeric (IPAddress) Then
wscript.echo "This needs to be an IP address like 1.1.1.1"
call enterip
else
'if cancel is pressed
if IPAddress = "" then
wscript.quit
end if
end if
End Sub
The problem I have is that the IsNumeric function is incorrect for an ip addres function, presumably because it has '.' in.
Does anyone know how or if there is a function for an IP address format. I though maybe using regular expressions and the instr function...
#thanks