Jump to content

Recommended Posts

Posted

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 ?

Posted

Hi spymare,

use StringSplit():

$arrayTemp = StringSplit("192.168.1.1",".")
$sFirstTwoBytes= $arrayTemp[1] & "." & $arrayTemp[2]

Regards,

Hannes

:graduated:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted (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,

UEZ

Edit: I did not read carefully the 1st post Posted Image

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted (edited)

thx it works :graduated: 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")

Else

MsgBox(16,"Error","You computer is not connected to System Biologi network")

endif

Edited by spymare
Posted

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

Posted

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...