Adolfik Posted July 23, 2010 Share Posted July 23, 2010 I couldn't find it anywhere ;/ so I need to ask here I got few values like $1,$2,$3 all are just numbers and I need to find which one of them is the biggest one. Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 23, 2010 Moderators Share Posted July 23, 2010 Adolfik,How about putting the values into an array and using _ArrayMax? I couldn't find it anywhereIt is in the Help file! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ClayB Posted July 23, 2010 Share Posted July 23, 2010 How are the values stored? Excel spreadsheet, text file, data structure (array, linked list, etc)? If it is in a text file, is there any other data in the file? Link to comment Share on other sites More sharing options...
cageman Posted July 23, 2010 Share Posted July 23, 2010 simple way is with if statements. if $1>=$2 and $1>=$3 Then $max=$1; elseif $2>=3 Then $max=$2; else $max=$3; endif Link to comment Share on other sites More sharing options...
Pottery Posted July 23, 2010 Share Posted July 23, 2010 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 More sharing options...
koman92040 Posted June 23, 2012 Share Posted June 23, 2012 Is there any way to do this with a mufti denominational array, using only one collum? Link to comment Share on other sites More sharing options...
water Posted June 23, 2012 Share Posted June 23, 2012 "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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
koman92040 Posted June 24, 2012 Share Posted June 24, 2012 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 haveTCPStartup() $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 More sharing options...
water Posted June 24, 2012 Share Posted June 24, 2012 (edited) 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 June 24, 2012 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
koman92040 Posted June 25, 2012 Share Posted June 25, 2012 Thanks so much! Link to comment Share on other sites More sharing options...
water Posted June 25, 2012 Share Posted June 25, 2012 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now