Jump to content

Find largest value


Recommended Posts

  • Moderators

Adolfik,

How about putting the values into an array and using _ArrayMax? ;)

I couldn't find it anywhere

It is in the Help file! :blink:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Examples

#include <Array.au3>
Dim $Array[4]
$Array[0] = 4
$Array[1] = 9
$Array[2] = 1
$Array[3] = 5
MsgBox(64, 'Example #1', 'The biggest value is ' & _ArrayMax($Array) & '.')

#include <Array.au3>
Dim $Array[4]
$Array[0] = 4
$Array[1] = 9
$Array[2] = 1
$Array[3] = 5
_ArrayDisplay($Array)

#include <Array.au3>
Dim $Array[4]
For $i = 0 to 3
    $Array[$i] = Random(0, 99)
Next
MsgBox(64, 'Example #3', 'The biggest value is ' & _ArrayMax($Array) & '.')
_ArrayDisplay($Array)
Link to comment
Share on other sites

  • 1 year later...

"mufti denominational array"? Or do you mean a "multi dimensional array"?

BTW: You necro a thread that is nearly 2 years old.

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

pardon my spelling "multi dimensional array" here's what i'm doing, I'm using one array to store The Hostame, IP address and Ping response time in a 2 dimensional array (5 by 3) then bases on the Ping response value launch a remote assistance session.

So far I have

TCPStartup()
$input = InputBox(@ScriptName, "Hostname:",)
If @error Then
TCPShutdown()
Exit
EndIf
$hostname = StringStripWS($input, 8)
Dim $ping[5][3] = [[4],[$hostname],[$hostname & ".example.com"],[$hostname & ".in.example.com"],[$hostname & ".corp.in.example.com"]]
While 1
For $loop = 1 To $ping[0][0]
  $ping[$loop][1] = TCPNameToIP($ping[$loop][0])
  $ping[$loop][2] = Ping($ping[$loop][1])
Next
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
TCPShutdown()

but right now it users the first pingable FQDN, i want the fastest responding FQDN.

I realize this is an old post, i goggled and found this topic and thought it was applicable to what i'm doing. If

Link to comment
Share on other sites

I would use something like this to use the fastest connection:

$input = InputBox(@ScriptName, "Hostname:",)
If @error Then Exit
TCPStartup()
$hostname = StringStripWS($input, 8)
Global $ping[5][3] = [[4],[$hostname],[$hostname & ".example.com"],[$hostname & ".in.example.com"],[$hostname & ".corp.in.example.com"]]
Global $iFastestValue = 9999999999999, $iFastestIndex = 0
While 1
    For $loop = 1 To $ping[0][0]
        $ping[$loop][1] = TCPNameToIP($ping[$loop][0])
        $ping[$loop][2] = Ping($ping[$loop][1])
        If $ping[$loop][2] > 0 And $ping[$loop][2] < $iFastestValue Then
            $iFastestValue = $ping[$loop][2]
            $iFastestIndex = $loop
        EndIf
    Next
    TrayTip("Launching Connection", "Remote Assistance is launching a connection to " & $ping[$iFastestIndex][0] & " at " & $ping[$iFastestIndex][1] & " wich responded in " & $ping[$iFastestIndex][2] & "ms", 30)
    Run("msra.exe /offerra " & $ping[$iFastestIndex][1])
    ExitLoop
WEnd
TCPShutdown()
Edited by water

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

:D

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