Jump to content

Need help to find VPN address and display


Recommended Posts

Hi all genius,

I Need help to find VPN address and display on GUI

Code should display address starting with 10.199.x.x and if not present then should display " VPN NOT CONNECTED ".

my code :

Local $sTestSegment = "10.199."

Local $sVPNAddress[0]="VPN NOT CONNECTED "

Local $sAll_IP = "," & @IPAddress1 & "," & @IPAddress2 &","& @IPAddress3 &","& @IPAddress4 & ","

Local $aMatches=StringRegExp($sAll_IP, ",(" & StringReplace($sTestSegment, ".", "\.") & ".+?),",3)

If

IsArray($aMatches)

then

$Input3 = GUICtrlCreateInput($aMatches[0], 232, 247, 145, 21,$ES_READONLY)]

Else

$Input3 = GUICtrlCreateInput("VPN NOT CONNECTED", 232, 247, 145, 21,$ES_READONLY)]

Thanks in advance

Link to comment
Share on other sites

Hi all genius,

I Need help to find VPN address and display on GUI

Code should display address starting with 10.199.x.x and if not present then should display " VPN NOT CONNECTED ".

my code :

Local $sTestSegment = "10.199."

Local $sVPNAddress[0]="VPN NOT CONNECTED "

Local $sAll_IP = "," & @IPAddress1 & "," & @IPAddress2 &","& @IPAddress3 &","& @IPAddress4 & ","

Local $aMatches=StringRegExp($sAll_IP, ",(" & StringReplace($sTestSegment, ".", "\.") & ".+?),",3)

If

IsArray($aMatches)

then

$Input3 = GUICtrlCreateInput($aMatches[0], 232, 247, 145, 21,$ES_READONLY)]

Else

$Input3 = GUICtrlCreateInput("VPN NOT CONNECTED", 232, 247, 145, 21,$ES_READONLY)]

Thanks in advance

What's it currently doing/not doing that's causing problems?

Mallie

Are you telling me something I need to know or something I want to know?

Link to comment
Share on other sites

Does nothing shows syntax error

Then simplify it.

Assuming you are running this on a local computer, that computer will likely only have 1 VPN address. In that case you only want to pick that one address out and display it:

Local $sTestSegment = "10.199"
Local $sVPNAddress= "VPN NOT CONNECTED"
Local $sMatches

If StringLeft(@IPADDRESS1, 6) = $sTestSegment Then 
    $sMatches = @IPADDRESS1
ElseIf StringLeft(@IPADDRESS2, 6) = $sTestSegment Then 
    $sMatches = @IPADDRESS2
ElseIf StringLeft(@IPADDRESS3, 6) = $sTestSegment Then 
    $sMatches = @IPADDRESS3
ElseIf StringLeft(@IPADDRESS4, 6) = $sTestSegment Then 
    $sMatches = @IPADDRESS4
Else
    $sMatches = "VPN NOT CONNECTED"
EndIf

Global $Input3 = GUICtrlCreateLabel($sMatches, 232, 247, 145, 21)

Once you've simplified it and got the info you want, then you can go in and condense the code if you need to.

Hope this helps.

Mal

Are you telling me something I need to know or something I want to know?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...