szucsaaron Posted October 14, 2012 Share Posted October 14, 2012 Hi! I was wandering how to found out what is the smallest number out of 5 I have already managed to do the same with 2 numbers (Local $a = Random(1, 100) Local $b = Random(1, 100) Local $c = Random(1, 100) Local $d = Random(1, 100) Local $e = Random(1, 100) Local $f = $a - $b If $f > 0 Then MsgBox(0, "The bigger number is", $a) EndIf If $f < 0 Then MsgBox(0, "The bigger number is", $b) EndIf If $f = 0 Then MsgBox(0, "Szám", "The numbers are equal") EndIf but i cannot do it with 5 Please help! Thank you! Link to comment Share on other sites More sharing options...
cageman Posted October 14, 2012 Share Posted October 14, 2012 (edited) make an array out of them. local $minimum,$index,$amountofnumbers = 5 local $array[$amountofnumbers] for $i=1 to $amountofnumbers $array[$i] = Random(1, 100) next $minimum = $array[1] $index = 1 for $i=2 to ubound($array)-1 if ($array[$i] < $minimum ) Then $minimum = $array[$i] $index = $i Endif next Its more like pseudo code, but something like this should work. Edited October 14, 2012 by cageman Link to comment Share on other sites More sharing options...
szucsaaron Posted October 14, 2012 Author Share Posted October 14, 2012 Sorry im a newbie how can i make an array? Link to comment Share on other sites More sharing options...
cageman Posted October 14, 2012 Share Posted October 14, 2012 (edited) local $size = 5 local $myarray[$size] $myarray[4] = 8 would make a variable $myarray, which is an array of size 5). Thus contains 5 values. You can set one of the values, by selecting $myarray[4], would select the 4th value. The zero value in the array is the number of elements $myarray[0] would thus be equal to 5. Edited October 14, 2012 by cageman Link to comment Share on other sites More sharing options...
szucsaaron Posted October 14, 2012 Author Share Posted October 14, 2012 Thanks but how can i reach the script to write it out in a MsgBox ? Link to comment Share on other sites More sharing options...
szucsaaron Posted October 14, 2012 Author Share Posted October 14, 2012 Or could you just write the whole script in one piece please? Link to comment Share on other sites More sharing options...
guinness Posted October 14, 2012 Share Posted October 14, 2012 Sorry im a newbie how can i make an array?Not a valid excuse around here I'm afraid. Why not look in the help file for arrays first as someone providing an example here isn't that much help if you don't understand them. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
szucsaaron Posted October 14, 2012 Author Share Posted October 14, 2012 i have checked it but i do not understand it so sorry :S Link to comment Share on other sites More sharing options...
guinness Posted October 14, 2012 Share Posted October 14, 2012 Really? It's not something you can grasp in 20 seconds of reading the help file. You have to search the forum, find examples and learn. What about this >> http://www.autoitscript.com/wiki/Arrays did you find this when searching about arrays? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
caleb41610 Posted October 14, 2012 Share Posted October 14, 2012 (edited) If you put in the effort yourself, once in a while people will throw code at you to help, because they know you attempt on your own.If not, I guarantee you will not find what you are looking for here.Making an array is one of the first few things you learn just by reading some basics about autoit. didn't even open scite and look at the help file..first item that popped up on google: http://en.wikipedia.org/wiki/AutoItCheck it out.. Edited October 14, 2012 by caleb41610 Multi-Connection TCP Server Link to comment Share on other sites More sharing options...
szucsaaron Posted October 14, 2012 Author Share Posted October 14, 2012 Yes. I am really sorry but as I said I am newbie to programming. Could you help me nayway? Link to comment Share on other sites More sharing options...
Developers Jos Posted October 14, 2012 Developers Share Posted October 14, 2012 (edited) Yes. I am really sorry but as I said I am newbie to programming.Could you help me nayway? They have been clear. Next post on this topic without any demonstration of effort will urn you a short posting vacation from these forums. Edited October 14, 2012 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
szucsaaron Posted October 14, 2012 Author Share Posted October 14, 2012 Okay. I am really sorry. Thank you all for helping! Link to comment Share on other sites More sharing options...
Malkey Posted October 15, 2012 Share Posted October 15, 2012 Hi! I was wandering how to found out what is the smallest number out of 5 I have already managed to do the same with 2 numbers (Local $a = Random(1, 100) Local $b = Random(1, 100) Local $c = Random(1, 100) Local $d = Random(1, 100) Local $e = Random(1, 100) Local $f = $a - $b If $f > 0 Then MsgBox(0, "The bigger number is", $a) EndIf If $f < 0 Then MsgBox(0, "The bigger number is", $b) EndIf If $f = 0 Then MsgBox(0, "Szám", "The numbers are equal") EndIf but i cannot do it with 5 Please help! Thank you! Expanding your example, and not using arrays, there is this example. Local $a = Random(1, 100, 1) Local $b = Random(1, 100, 1) Local $c = Random(1, 100, 1) Local $d = Random(1, 100, 1) Local $e = Random(1, 100, 1) Local $sText = _ "$a = " & $a & @LF & _ "$b = " & $b & @LF & _ "$c = " & $c & @LF & _ "$d = " & $d & @LF & _ "$e = " & $e & @LF & "The smallest number is" If $a <= $b And $a <= $c And $a <= $d And $a <= $e Then $sText &= ", $a = " & $a If $b <= $a And $b <= $c And $b <= $d And $b <= $e Then $sText &= ", $b = " & $b If $c <= $a And $c <= $b And $c <= $d And $c <= $e Then $sText &= ", $c = " & $c If $d <= $a And $d <= $b And $d <= $c And $d <= $e Then $sText &= ", $d = " & $d If $e <= $a And $e <= $b And $e <= $c And $e <= $d Then $sText &= ", $e = " & $e MsgBox(0, "Results", $sText) 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