Jump to content

Find Greatest value in a given column of a muti-dimensional array


Recommended Posts

hello,

i'm writing a script to overcome the obstacles of our company's nested sub-domains for the LAN and Microsoft Remote assistance.

The final product sloud ping the hostname as well as the hostname in all three nested subdomains, and connect to the fastest responding domain. Right now it connects to the first pingable domain in the list, this is not acceptable as my older version of this script has hung up on outdated dns records on the first loop.

the issue i am running into is i'm doing all the work out of a muti-dimensional array, so i cannot use _ArrayMax() in the traditional meaner. Any ieas

so far my script looks something like this:

#include <GUIConstantsEx.au3>
#include <Array.au3>
While 1
TCPStartup()
$input = InputBox(@ScriptName, "Hostname:")
If @error Then
Exit
EndIf
$hostname = StringStripWS($input, 8)
Dim $ping[5][3] = [[4],[$hostname],[$hostname & ".example.com"],[$hostname & ".in.example.com"],[$hostname & ".corp.in.example.com"]]
For $loop = 1 To $ping[0][0]
$ping[$loop][1] = TCPNameToIP($ping[$loop][0])
$ping[$loop][2] = Ping($ping[$loop][1])
Next
TCPShutdown()
For $loop = 1 To $ping[0][0]
If $ping[$loop][2] Then
TrayTip("Launching Connection", "Remote Assistance is launching a connection to " & $ping[$loop][0] & " at " & $ping[$loop][1] & " wich responded in " & $ping[$loop][2] & "ms", 30)
Run("msra.exe /offerra " & $ping[$loop][1])
ExitLoop
EndIf
Next
WEnd
Edited by koman92040
Link to comment
Share on other sites

I just posted a solution

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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