_Vlad Posted February 23, 2020 Share Posted February 23, 2020 Hello, I have this script : #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 224, 93, -1, -1) $Input1 = GUICtrlCreateInput("", 16, 16, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $Button1 = GUICtrlCreateButton("test", 16, 48, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Calculate() EndSwitch WEnd Func _Calculate() $last = 0 $open = 0 For $i = 1 To GUICtrlRead($Input1) Step 50 $open += 1 Next $last = 50 * $open MsgBox(0,'', $open & @CRLF & $last) EndFunc Basically this script tells me how many times can fit 50 in a number. What i search for is that if I have a number like (103), to count 2 times 50 and tell me that 3 is the difference. How can I do that? Many thanks! Link to comment Share on other sites More sharing options...
Subz Posted February 23, 2020 Share Posted February 23, 2020 (edited) Wouldn't it be something like: Func _Calculate() $iOrgNum = GUICtrlRead($Input1) $iDivNum = Floor($iOrgNum/50) MsgBox(4096, "", "50 Count = " & $iDivNum & @CRLF & "Difference: " & Mod($iOrgNum, 50)) EndFunc * Updated to use Floor and Mod Edited February 23, 2020 by Subz _Vlad 1 Link to comment Share on other sites More sharing options...
Nine Posted February 23, 2020 Share Posted February 23, 2020 Round may not be the thing you want it should be Floor or Int functions. As for the remainder you could use Mod function. _Vlad 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
RTFC Posted February 23, 2020 Share Posted February 23, 2020 Mod _Vlad 1 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
_Vlad Posted February 25, 2020 Author Share Posted February 25, 2020 Thank you all guys for the help! I didn't knew about these functions. 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