Sign in to follow this  
Followers 0
borism25

help to undestand the script

14 posts in this topic

this script is from the member guinness

I searching in the help file but i can't find what i need...so for start i have questions what this do on the script

1. - (For $A = 1 To $aArray[0][0]) can someone explain me what change in what, i am really confused...

1.1. - $sData &= "Description: " & $aArray[$A][0] & @CRLF & "IP Address: " & $aArray[$A][1] & @CRLF & "MAC: " & _

$aArray[$A][2] & @CRLF & "Default Gateway: " & $aArray[$A][3] & @CRLF & "DNS Servers: " & $aArray[$A][4] & @CRLF & "Connection Name: " & _GetNetworkID($aArray[$A][0]) & @CRLF & @CRLF (does "For $A = 1 To $aArray[0][0]" change something in this "$aArray[$A][0]")

2. - next is ($sData = StringTrimRight($sData, 4)) this remove 4 characters from the $sData??

3. $aReturn and $iCount what this does...

If someone can write explanation to this script i will be very grateful, what line do something

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <Array.au3>

Global $aArray = _IPDetails(), $sData
_ArrayDisplay($aArray)

For $A = 1 To $aArray[0][0]
    $sData &= "Description: " & $aArray[$A][0] & @CRLF & "IP Address: " & $aArray[$A][1] & @CRLF & "MAC: " & _
            $aArray[$A][2] & @CRLF & "Default Gateway: " & $aArray[$A][3] & @CRLF & "DNS Servers: " & $aArray[$A][4] & @CRLF & "Connection Name: " & _GetNetworkID($aArray[$A][0]) & @CRLF & @CRLF
Next
$sData = StringTrimRight($sData, 4)


MsgBox(0, "_IPDetails()", $sData)


Func _IPDetails()
    Local $iCount = 0
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True", "WQL", 0x30), $aReturn[1][5] = [[0, 5]]
    If IsObj($oColItems) Then
        For $oObjectItem In $oColItems
            $aReturn[0][0] += 1
            $iCount += 1

            If $aReturn[0][0] <= $iCount + 1 Then
                ReDim $aReturn[$aReturn[0][0] * 2][$aReturn[0][1]]
            EndIf

            $aReturn[$iCount][0] = _IsString($oObjectItem.Description)
            $aReturn[$iCount][1] = _IsString($oObjectItem.IPAddress(0))
            $aReturn[$iCount][2] = _IsString($oObjectItem.MACAddress)
            $aReturn[$iCount][3] = _IsString($oObjectItem.DefaultIPGateway(0))
            $aReturn[$iCount][4] = _IsString(_WMIArrayToString($oObjectItem.DNSServerSearchOrder(), " - ")) ; You could use _ArrayToString() but I like creating my own Functions especially when I don't need alot of error checking.
        Next
        ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1]]
        Return $aReturn
    EndIf
    Return SetError(1, 0, $aReturn)
EndFunc   ;==>_IPDetails

Func _GetNetworkID($sAdapter)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColItems = $oWMIService.ExecQuery('Select * From Win32_NetworkAdapter Where Name = "' & $sAdapter & '"', "WQL", 0x30)
    If IsObj($oColItems) Then
        For $oObjectItem In $oColItems
            Return $oObjectItem.NetConnectionID
        Next
    EndIf
    Return SetError(1, 0, "Unknown")
EndFunc   ;==>_GetNetworkID

Func _IsString($sString)
    If IsString($sString) Then
        Return $sString
    EndIf
    Return "Not Available"
EndFunc   ;==>_IsString

Func _WMIArrayToString($aArray, $sDelimeter = "|")
    If IsArray($aArray) = 0 Then
        Return SetError(1, 0, "Not Available")
    EndIf
    Local $iUbound = UBound($aArray) - 1, $sString
    For $A = 0 To $iUbound
        $sString &= $aArray[$A] & $sDelimeter
    Next
    Return StringTrimRight($sString, StringLen($sDelimeter))
EndFunc   ;==>_WMIArrayToString

Share this post


Link to post
Share on other sites



$aArray[0][0] is the number of "items" in $aArray

For $A=1 to $aArray[0][0] is counting 1 to however many items are in $aArray[0][0]

1.1 is just simply listing out the details of each item found in $aArray[0][0]

2. The last 4 characters, correct.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

borism25,

1. For $A = 1 To $aArray[0][0]

The array returned by the _IPDetails function has the count of the elements in the [0][0] element. You can therefore use this value to loop through the elements in the array. If you do not have a count element like this, you need to use UBound to measure the number of elements. Here a a sample 1D array with a count element to explain:

[0] = 3
[1] = Value 1
[2] = Value 2
[3] = Value 3

Here 1 To $aArray[0] would give you 1, 2, 3. And here is an array without a count element:

[0] = Value 0
[1] = Value 1
[2] = Value 2
[3] = Value 3

Here we would use UBound($aArray) - 1. UBound would return the number of elements (4) so we need to use UBound - 1 to get the highest value (3).

1.1 does "For $A = 1 To $aArray[0][0]" change something in this "$aArray[$A][0]"

Yes, the value of $A increases by 1 each time you go through the For...Next loop - so you get each value of the array in turn.

2. $sData = StringTrimRight($sData, 4)

Yes, as the name suggests, this function removes 4 characters from the righthand side of the string. So "12345678" would become "1234".

3. $aReturn and $iCount

Another way of looping through an array is to use a For...In...Next loop. This is particularly useful when you deal with Objects as there is no simple way of getting the count of the elements within them (as mentioned above you can use UBound with arrays). Sometimes you have a .Count property, but not always. So a For...In...Next loop just runs automatically through the Object content until it reaches the end.

Because there is no way to count in advance, the array being filled from the Object nees a counter to put the values into the correct elements, so $iCount is increased each time and is then used to ReDim the array so it is large enough and to put the data into the correct elements.

$aReturn is just the array being created and ultimately returned.

Is that good enough? :)

Ask again if you do not understand anything. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

borism25,

Is that a question? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

honestly i don't understand can you explain part by part :) something like this:

For $A = 1 To $aArray[0][0] ;$A Increase By one (BTW i don't know how these will count in the $sData)
    $sData &= "Description: " & $aArray[$A][0] & @CRLF & "IP Address: " & $aArray[$A][1] & @CRLF & "MAC: " & _
            $aArray[$A][2] & @CRLF & "Default Gateway: " & $aArray[$A][3] & @CRLF & "DNS Servers: " & $aArray[$A][4] & @CRLF & "Connection Name: " & _GetNetworkID($aArray[$A][0]) & @CRLF & @CRLF
Next
$sData = StringTrimRight($sData, 4)

For $A = 1 To $aArray[0] (if have just one [0] does this true)

[0] = Value 0

[1] = Value 1

[2] = Value 2

[3] = Value 3

but what if it have like in this example ??? does this good (i think that's not)

For $A = 1 To $aArray[0][0]

[0] = Value 0

[1] = Value 11

[2] = Value 22

[3] = Value 33

or you can create some simple script with this arrays to get understand ;)

thnx for help

EDIT: i post wrong sorry my bed ;) i am delete

Edited by borism25

Share this post


Link to post
Share on other sites

I did reply to your PM you sent me :) But the explanation that Melba23 gave was a little better than mine!


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

you can create some simple script with this arrays to get understand

Or you could read the Arrays tutorial in the Wiki" :)

But here is a short script that might help:

; A simple array with a count element 
Global $aArray[4] = [3, "Value 1", "Value 2", "Value 3"]

; Which we use to loop through the array
For $i = 1 To $aArray[0]
    MsgBox(0, "Count = " & $i, " Element [" & $i & "] = " & $aArray[$i])
Next

; -----------------------------------

; Another array with no count element
Global $aArray[4] = ["", "Value 1", "Value 2", "Value 3"]

MsgBox(0, "UBound", "The highest array element is" & @CRLF & UBound($aArray) - 1)

; So we use that value to loop through the array
For $i = 1 To UBound($aArray) - 1
    MsgBox(0, "Count = " & $i, " Element [" & $i & "] = " & $aArray[$i])
Next

Clearer now? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Or you could read the Arrays tutorial in the Wiki" ;)

But here is a short script that might help:

; A simple array with a count element 
Global $aArray[4] = [3, "Value 1", "Value 2", "Value 3"]

; Which we use to loop through the array
For $i = 1 To $aArray[0]
    MsgBox(0, "Count = " & $i, " Element [" & $i & "] = " & $aArray[$i])
Next

; -----------------------------------

; Another array with no count element
Global $aArray[4] = ["", "Value 1", "Value 2", "Value 3"]

MsgBox(0, "UBound", "The highest array element is" & @CRLF & UBound($aArray) - 1)

; So we use that value to loop through the array
For $i = 1 To UBound($aArray) - 1
    MsgBox(0, "Count = " & $i, " Element [" & $i & "] = " & $aArray[$i])
Next

Clearer now? ;)

M23

i think that now some things i figure out thnx to melba and guinness, need to read (slowly) from guinness "tutorial" ReDim ...

Will read it tomorow few more times and ask it if i have question :) i am tired of reading today :D

thnx for quick replays

Edited by borism25

Share this post


Link to post
Share on other sites

to say it in short ReDim just changes array size w/o clearing array

if you have Dim array[3] then you create arrray with 3 elements, now lets say you want to use 4 elements in array then you need ReDim array[4].

just Dim array[4] would delete all it's elements, which means data goes lost, but when you use ReDim array[4], you can resize it with out loosing data.

Hope it helped.


edited

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Cool! The _ReDim tutorial is about how I use ReDim in an effective way and this might not be the right way but I've found it to be effective in my Scripts :) Just look at the speed increase in the Examples provided.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

hi guys, before 2 minutes i come home from work and start reading :) let's see if i understand something

For $A = 1 $aArray [0][0]

will change it to the [1][0]

it will be row 1 and fill it from the $sData ( 5 columns becouse i have )

"Description: " & $aArray[$A][0] & @CRLF &

"IP Address: " & $aArray[$A][1] & @CRLF &

"MAC: " & _$aArray[$A][2] & @CRLF &

"Default Gateway: " & $aArray[$A][3] & @CRLF &

"DNS Servers: " & $aArray[$A][4] & @CRLF & "Connection Name: " & _GetNetworkID($aArray[$A][0]) & @CRLF & @CRLF

after that script geting the info, if getting +1 than will be and show me what is the resoult

[2][1]

if not than i get the

[2][0] (than change it to the "not available")

and that's it

does it good or not ;)

Share this post


Link to post
Share on other sites

Please use [autoit][/autoit] tags when posting code and this makes things a little easier to read when you start posting larger code. The first part is correct (but needs to be tweaked a little e.g. $sData &= "Description: ....") and the second part of your question I don't understand.

I missed your last post so thanks for PM'ing me!


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

hmm second part, do you think on this

after that script geting the info, if getting +1 than will be and show me what is the resoult

[2][1]

if not than i get the

[2][0] (than change it to the "not available")

i am thinking on this (look down), does the "$aReturn[0][0] += 1" give me [1][0] or [0][1] (and than increase by one?)

Func _IPDetails()
    Local $iCount = 0
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True", "WQL", 0x30), $aReturn[1][5] = [[0, 5]]
    If IsObj($oColItems) Then
        For $oObjectItem In $oColItems
            $aReturn[0][0] += 1
            $iCount += 1

            If $aReturn[0][0] <= $iCount + 1 Then
                ReDim $aReturn[$aReturn[0][0] * 2][$aReturn[0][1]]
            EndIf

            $aReturn[$iCount][0] = _IsString($oObjectItem.Description)
            $aReturn[$iCount][1] = _IsString($oObjectItem.IPAddress(0))
            $aReturn[$iCount][2] = _IsString($oObjectItem.MACAddress)
            $aReturn[$iCount][3] = _IsString($oObjectItem.DefaultIPGateway(0))
            $aReturn[$iCount][4] = _IsString(_WMIArrayToString($oObjectItem.DNSServerSearchOrder(), " - ")) ; You could use _ArrayToString() but I like creating my own Functions especially when I don't need alot of error checking.
        Next
        ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1]]
        Return $aReturn
    EndIf
    Return SetError(1, 0, $aReturn)
EndFunc   ;==>_IPDetails
Edited by borism25

Share this post


Link to post
Share on other sites

No, this adds 1 to the value located in $aReturn[0][0], as I use this to determine how many items are in the Array.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
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
Sign in to follow this  
Followers 0