Skip to content
⌘ NSIS Forum Archive

ip addres script question

6 posts

sixcode#

ip addres script question

hi all
I'm trying to make a script based upon the script of Hendri Adriaens fouded here: http://nsis.sourceforge.net/wiki/IPTest

what im trying to do is after 4 times checking the Network IP-address the script must end but for some reason i cant get this to work, if not connected the script loops.

any help
Section
  ; Code to use actual ExtensionDLL
  ; Current script provides an example
 
;Pop $0
--->  again:
  ip::get_ip
  Pop $0
 
   ;test entry
  ;StrCpy $0 '192.168.0.100;127.0.0.1;152.168.0.101;169.254.0.1;'
  
  Loop:
  Push $0
  Call GetNextIp
  Call CheckIp
  Pop $2 ; Type of current IP-address
  Pop $1 ; Current IP-address
  Pop $0 ; Remaining addresses
  ;StrCmp $2 '1' '' NoLoopBackIp
  ;  MessageBox MB_OK "LoopBack IP-address: $1"
  ;  Goto Continue
  ;NoLoopBackIp:
  ;StrCmp $2 '2' '' NoAPA
  ;  MessageBox MB_OK "Automatic Private IP-address: $1"
  ;  Goto Continue
  ;NoAPA:
  StrCmp $2 '3' '' NoLanIp
    MessageBox MB_OK "$2 Network IP-address: $1"
    Goto Continue
    ---> noLanIp:
            ClearErrors
    --->       IntOp $4 $4 + 1
    --->             StrCmp $R2 4 kill
              MessageBox MB_OK|MB_ICONEXCLAMATION "$\r$\n$R2 Netwerk Internet verbindings fout :$\r$\n$\r$\nKan geen verbinding maken met server, bezig met opnieuw proberen...     "
--->      Goto again
--->      kill:
         MessageBox MB_OK|MB_ICONEXCLAMATION "$\r$\nR2 Kan geen Internet Vebinding maken, setup sluit nu af...     "
   quit
      ;MessageBox MB_OK|MB_ICONEXCLAMATION "$\r$\nKan geen Internet Vebinding maken, setup sluit nu af...     "
      ; quit
  ;MessageBox MB_OK "Internet IP-address: $1"
  Continue:
  StrCmp $0 '' ExitLoop ExitLoop2
  ExitLoop:
  ExitLoop2: 
quit
SectionEnd 
sixcode#
Hi Stu
this isn't working to :
IntOp $2 $2 + 1
StrCmp $2 4 kill 
what variable must i use to get it to work?
Afrow UK#
Logically, a variable that isn't being used in the rest of the script; otherwise its value will get overwrited elsewhere.

-Stu
sixcode#
answer:
IntOp $4 $4 + 1
StrCmp $4 4 kill 
    Push $R0
    
    again:
      
      ip::get_ip
      Pop $0
      
      Push $0
      Call GetNextIp
      Call CheckIp
      Pop $2 ; Type of current IP-address
      Pop $1 ; Current IP-address
      Pop $0 ; Remaining addresses
      StrCmp $2 '3' '' NoLanIp
      ;MessageBox MB_OK "Network IP-address: $1"
      Goto Continue5
      noLanIp:
        ClearErrors
        IntOp $4 $4 + 1
      StrCmp $4 4 kill
        MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$\r$\nPoging $4 van 3 $\r$\nNetwerk Internet verbindings fout :$\r$\n$\r$\nKan geen verbinding maken met server, druk op OK om het opnieuw te proberen...     " IDCANCEL EXIT
        Goto again
        kill:
        MessageBox MB_OK|MB_ICONEXCLAMATION "$\r$\nKan geen Netwerk Internet Vebinding maken, setup sluit nu af...     "
      quit
      Continue5:
      EXIT:
    QUIT