eHrgo Posted February 28, 2007 Share Posted February 28, 2007 Hi all, I have 7 variables, 7 positive values, I want to know which one is the biggest... is there any command to do that? I searched .. but found nothing. Thanks Sorry for my Bad English. Link to comment Share on other sites More sharing options...
HardHackz Posted February 28, 2007 Share Posted February 28, 2007 well, if they are numbers you can do > or <, im not sure if this works for the length of strings [center]My BlogOldSock Programs (AutoIT Apps)A Message to Hackers! (NOT SKIDDIES!)OldSock Programs is my little "company."[/center] Link to comment Share on other sites More sharing options...
eHrgo Posted February 28, 2007 Author Share Posted February 28, 2007 Sorry for my bad english, i don't want to check there lenght. I want to check which one of my 10 variables is the highest. I can't use < > .. Sorry for my Bad English. Link to comment Share on other sites More sharing options...
HardHackz Posted February 28, 2007 Share Posted February 28, 2007 the highest what? highest number? if it's number, that's specifically what > and < are for you do a if $var > $var2 Then if$var < $var2 Then [center]My BlogOldSock Programs (AutoIT Apps)A Message to Hackers! (NOT SKIDDIES!)OldSock Programs is my little "company."[/center] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2007 Moderators Share Posted February 28, 2007 (edited) If your question has not been answered, at least provide a list of the 7 variables you want to check and their current values. Edited February 28, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 28, 2007 Share Posted February 28, 2007 Hi, #include<Array.au3> Global $values[7] = [10,54,3,56,234,324,33] MsgBox(64, "Highest Value", _ArrayMax($values, 1)) So long, 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 More sharing options...
Moderators SmOke_N Posted February 28, 2007 Moderators Share Posted February 28, 2007 Hi, #include<Array.au3> Global $values[7] = [10,54,3,56,234,324,33] MsgBox(64, "Highest Value", _ArrayMax($values, 1)) So long, MegaYou are assuming he's using an array (which of course is the easiest way) ... but I see no mention of an array being used, only the mention of 7 "different" variables. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 28, 2007 Share Posted February 28, 2007 If this is just strings, then he can convert them to an array... but it seems that there a problem:$String1 = 1 $String2 = 2 $String3 = 3 $String4 = 4 $String5 = 5 $String6 = 6 $String7 = 7 $StringsArr = StringSplit($String1 & "|" & $String2 & "|" & $String3 & "|" & $String4 & "|" & _ $String5 & "|" & $String6 & "|" & $String7, "|") $BiggestString = $StringsArr[1] For $iArr = 1 To $StringsArr[0] If $StringsArr[$iArr] > $BiggestString Then $BiggestString = $StringsArr[$iArr] Next MsgBox(0, "", $BiggestString)If we put in $String3 (for example) value that higher then 7, then will returned 7 as biggest value, this even if you use the _ArrayMax() function, and i don't know why...  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2007 Moderators Share Posted February 28, 2007 $String1 = 1 $String2 = 2 $String3 = 3 $String4 = 7 $String5 = 5 $String6 = 6 $String7 = 4 $StringsArr = StringSplit($String1 & "|" & $String2 & "|" & $String3 & "|" & $String4 & "|" & _ $String5 & "|" & $String6 & "|" & $String7, "|") $BiggestString = 0 For $iArr = 1 To $StringsArr[0] If Number($StringsArr[$iArr]) > $BiggestString Then $BiggestString = $StringsArr[$iArr] $nString = $iArr EndIf Next MsgBox(0, "", 'The biggest Num was: ' & $BiggestString & @CR & 'On $String' & $nString) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 28, 2007 Share Posted February 28, 2007 Or, you can do somthing like that, this will be 100% exact: $String1 = 1 $String2 = 2 $String3 = 3 $String4 = 4 $String5 = 5 $String6 = 6 $String7 = 7 $BiggestString = $String1 If $String2 > $BiggestString Then $BiggestString = $String2 If $String3 > $BiggestString Then $BiggestString = $String3 If $String4 > $BiggestString Then $BiggestString = $String4 If $String5 > $BiggestString Then $BiggestString = $String5 If $String6 > $BiggestString Then $BiggestString = $String6 If $String7 > $BiggestString Then $BiggestString = $String7 MsgBox(0, "", $BiggestString)  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2007 Moderators Share Posted February 28, 2007 MsCreatoR ... again.. the best that any of us would be doing is drawing at straws with guesses without the OP showing what is they are "exactly" trying to do...But... there are many ways to do what you are showing... here's another if the string vars all had numbers on the end:Dim $String1 = 1,$String2 = 2,$String3 = 3,$String4 = 7,$String5 = 5,$String6 = 6,$String7 = 4,$BiggestString = 0, $nString = 1 For $iCC = 1 To 7 If Number(Eval('String' & $iCC)) > $BiggestString Then $BiggestString = Eval('String' & $iCC) $nString = $iCC EndIf Next MsgBox(0, "", 'The biggest Num was: ' & $BiggestString & @CR & 'On $String' & $nString) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 28, 2007 Share Posted February 28, 2007 SmOke_NNice solution, but why the function _ArrayMax() not work like that?the best that any of us would be doing is drawing at straws with guesses without the OP showing what is they are "exactly" trying to doAgree!  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2007 Moderators Share Posted February 28, 2007 (edited) SmOke_N Nice solution, but why the function _ArrayMax() not work like that? Agree! I would assume that _ArrayMax() isn't working because the $array[n] is more than likely a string, rather than a number, the way you are doing it.... to be honest, I've never even tried _ArrayMax() so I wouldn't be the best to answer it. Edited February 28, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted March 1, 2007 Share Posted March 1, 2007 (edited) I would assume that _ArrayMax() isn't working because the $array[n] is more than likely a string, rather than a number, the way you are doing it.... to be honest, I've never even tried _ArrayMax() so I wouldn't be the best to answer it. this works.. but it's for arrays.. err... added better example expandcollapse popup;example ;string.. $str = '' $aArray = StringSplit('abc,abcd,ab,absdhjgh,123,34,ash34,sddf',',') _Quick_Sort($aArray, 1, $aArray[0]) For $x = 1 To $aArray[0] $str &= $aArray[$x] &@LF Next MsgBox(0,'',$str) ;variables $str = '' $1 = 'abc' $2 = 'abcd' $3 = 'ab' $4 = 'sddf3466784534' $5 = 'absdhjgh' $6 = 'sddfgjughghjdfhffsdg4' Local $aArray[8] = [7,$1,$2,$3,$4,$5,$6] _Quick_Sort($aArray, 1, $aArray[0]) For $x = 1 To $aArray[0] $str &= $aArray[$x] &@LF Next MsgBox(0,'',$str) Func _Quick_Sort(ByRef $SortArray, $First, $Last);Larry's code Dim $Low, $High Dim $Temp, $List_Separator $Low = $First $High = $Last $List_Separator = StringLen($SortArray[ ($First + $Last) / 2]) Do While (StringLen($SortArray[$Low]) < $List_Separator) $Low = $Low + 1 WEnd While (StringLen($SortArray[$High]) > $List_Separator) $High = $High - 1 WEnd If ($Low <= $High) Then $Temp = $SortArray[$Low] $SortArray[$Low] = $SortArray[$High] $SortArray[$High] = $Temp $Low = $Low + 1 $High = $High - 1 EndIf Until $Low > $High If ($First < $High) Then _Quick_Sort($SortArray, $First, $High) If ($Low < $Last) Then _Quick_Sort($SortArray, $Low, $Last) EndFunc ;==>_Quick_Sort Edited March 1, 2007 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted March 1, 2007 Share Posted March 1, 2007 Sorry for my bad english, i don't want to check there lenght. I want to check which one of my 10 variables is the highest. I can't use < > ..oops. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() 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