spymare 0 Posted December 3, 2010 HI. with _getip() or @ipaddress1 i can get my ip like this : 192.322.32.34 Is it possible somehow to get only the first 2 bytes? like 192.322 ? Share this post Link to post Share on other sites
hannes08 39 Posted December 3, 2010 Hi spymare, use StringSplit(): $arrayTemp = StringSplit("192.168.1.1",".") $sFirstTwoBytes= $arrayTemp[1] & "." & $arrayTemp[2] Regards, Hannes Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Share this post Link to post Share on other sites
UEZ 1,278 Posted December 3, 2010 (edited) Try this method:$ip = "192.322.32.34" $aOctets = StringRegExp($ip, "^(\d+\.\d+)", 3) MsgBox(0, "IP", "1st 2 octets of " & $ip & " = " & $aOctets)Br,UEZEdit: I did not read carefully the 1st post Edited December 3, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
spymare 0 Posted December 3, 2010 (edited) thx it works but i need to get the ip address through _getip(), else i can do it like this:if $sFirstTwoBytes Then$outlook = _RunDos("start outlook.exe /c ipm.note /m helpdesk@bio.dtu.dk") ElseMsgBox(16,"Error","You computer is not connected to System Biologi network")endif Edited December 3, 2010 by spymare Share this post Link to post Share on other sites
spymare 0 Posted December 3, 2010 can anyone help me with this error when im not connected to internet i get a error (ipconfig /release) #include <Process.au3> #include <Inet.au3> #include <Array.au3> $test = (_getip()) $arrayTemp = StringSplit($test,".") $sFirstTwoBytes= $arrayTemp[1] & "." & $arrayTemp[2] if $sFirstTwoBytes Then $outlook = _RunDos("start outlook.exe /c ipm.note /m helpdesk@bio.dtu.dk") Else MsgBox(16,"Error","You computer is not connected to System Biologi network") endif Share this post Link to post Share on other sites
UEZ 1,278 Posted December 3, 2010 Try this: #include <Process.au3> #include <Inet.au3> #include <Array.au3> $get = (_getip()) $chk_ip = "192.222" $aOctets = StringRegExp($get, "^(\d+\.\d+)", 3) if $get = $aOctets[0] Then $outlook = _RunDos("start outlook.exe /c ipm.note /m helpdesk@bio.dtu.dk") Else MsgBox(16,"Error","You computer is not connected to System Biologi network") endif Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
spymare 0 Posted December 6, 2010 not working :/. tryed something like this :S: $what = ("292.38.13.111") $arrayTemp = StringSplit($what,".") $test = $arrayTemp = (_getip()) $sFirstTwoBytes = $arrayTemp[1] & "." & $arrayTemp[2] $test if $sFirstTwoBytes then $outlook = _RunDos("start outlook.exe /c ipm.note /m helpdesk@bio.dtu.dk") Else MsgBox(16,"Error","You computer is not connected to System Biologi network") endif Share this post Link to post Share on other sites