Jump to content

Trying to count @IPAddress[$i]


Recommended Posts

Hi,

I'm trying to evaluate from @IPAddress1 to @IPAddress4.

One possible way is this:

For $i = 1 to 4
    Select
        Case $i = 1
            $y = StringSplit(@IPAddress1, ".", 0)
        Case $i = 2
            $y = StringSplit(@IPAddress2, ".", 0)
        Case $i = 3
            $y = StringSplit(@IPAddress3, ".", 0)
        Case $i = 4
            $y = StringSplit(@IPAddress4, ".", 0)
    EndSelect
NextoÝ÷ Ù»­Ëaz·mëmz¼Êܡا*&zØb   bëaÌ(ºW[yø§y«­¢+Ù½ÈÀÌØí¤ôÄѼÐ($ÀÌØíäôMÑÉ¥¹MÁ±¥Ð¡%AÉÍÍlÀÌØí¥t°ÅÕ½Ðì¸ÅÕ½Ðì°À¤)9á

Any ideas...???

Link to comment
Share on other sites

Hi,

??? what should be the result?

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

should the result be 4 arrays in an array?

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Or

#include <Array.au3>
#include <String.au3>

Global $ip_A[4][4]
ConsoleWrite('!' & @IPAddress1 & @CRLF)
ConsoleWrite('!' & @IPAddress2 & @CRLF)
ConsoleWrite('!' & @IPAddress3 & @CRLF)
ConsoleWrite('!' & @IPAddress4 & @CRLF)

_createIP_A()
_printIP_A()

Func _createIP_A()
    For $i = 0 To 3
        $ip = _StringSplit(Execute("@IPAddress" & $i + 1), '.')
        For $y = 0 To 3
            $ip_A[$y][$i] = $ip[$y]
        Next
    Next
EndFunc   ;==>_createIP_A

Func _printIP_A()
    For $i = 0 To 3
        For $y = 0 To 3
            ConsoleWrite($ip_A[$y][$i] & @TAB)
            If $y = 3 Then ConsoleWrite(@CRLF)
        Next
    Next
EndFunc   ;==>printIP_A

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Or

#include <Array.au3>
#include <String.au3>

Global $ip_A[4][4]
ConsoleWrite('!' & @IPAddress1 & @CRLF)
ConsoleWrite('!' & @IPAddress2 & @CRLF)
ConsoleWrite('!' & @IPAddress3 & @CRLF)
ConsoleWrite('!' & @IPAddress4 & @CRLF)

_createIP_A()
_printIP_A()

Func _createIP_A()
    For $i = 0 To 3
        $ip = _StringSplit(Execute("@IPAddress" & $i + 1), '.')
        For $y = 0 To 3
            $ip_A[$y][$i] = $ip[$y]
        Next
    Next
EndFunc   ;==>_createIP_A

Func _printIP_A()
    For $i = 0 To 3
        For $y = 0 To 3
            ConsoleWrite($ip_A[$y][$i] & @TAB)
            If $y = 3 Then ConsoleWrite(@CRLF)
        Next
    Next
EndFunc   ;==>printIP_A

Mega

#include <Array.au3> is not needed there :D
Link to comment
Share on other sites

#include <Array.au3> is not needed there :D

OMG, just tested something before, but right you are ... :D

+> "Organize Includes" for AutoIt3 | Version 3.9 | © Th.Meger | 16.Apr.2008
!> ----------------------------------------------------------------------------------------------------
+> _StringSplit                                   > String.au3
!> ----------------------------------------------------------------------------------------------------
>Exit code: 0   Time: 1.959

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

@Lazycat

That's my favorite...

Thank you!

Then you will only have ipadress4 in y

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...