Hi again.

I'm presently making a script to detect the IP adress of a VPN address.

When KIX detects The same IP adress and the same gateway in a ipconfig /all command, it conclude that the IP are the same and can know that this is the VPN adress and not the other IP adresses.

Here is my question:
this test txt file.

IP Address. . . . . . . . . : 192.168.0.53
Subnet Mask . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . : 192.168.0.53

The IP and Gateway are the same.

I run my code and KIX correctly detect both addresses (192.168.0.53) but he always thinks that they are different when comparing.

What have i done wrong?

Here is my script:


; ******* Utilitaire pour détecter l'adresse IP d'un VPN ***
; ************** Partie 1 ******************
; *** Détection de la langue du Ipconfig ***

$tempfile = "c:\ipconfig.txt"
shell "%comspec% /c ipconfig /all > $tempfile"
$ = Open (1,"$tempfile")
while @error = 0
$x=readline(1)
if instr($x,"IP Address")
$ = close (1)
goto english
else
if instr($x,"Adresse IP")
$ = close (1)
goto francais
else
endif
endif
loop
goto error
; ************** Partie 2 ******************
; *** Détection de l'adresse VPN Anglais ***
:english
$ = Open (1,"$tempfile")
:again
do
$y = readline (1)
? "$y"
if instr($y,"IP address")
$IP = substr($y, instr($y,":")+2, 16)
? "$IP"
$y = readline (1)
$y = readline (1)
$Gate = substr($y, instr($y,":")+2, 16)
? "$gate"
? " if $IP = $gate "
if '$IP' = '$gate'
goto VPNaddress
else
goto again
endif
endif
until @error <> 0
goto error

; ************** Partie 3 ******************
; *** Détection de l'adresse VPN Francais ***
:francais
? "francais"
goto end

; ************** Partie 4 ******************
; *** Ipconfig ne donne aucune adresse ou ***
; ************ fonctionne mal **************
:error
? " Vous n'avez pas d'adresse valide"
goto end


:VPNaddress
" Voici l'adresse VPN c'est $IP"
:end
$ = close (1)
DEL $tempfile

Thank you

Frédéric Giguère