# Fraction divide calculator

## Recommended Posts

Here is a little script I have assemble. I need to see if two numbers could be divide from each other, fraction math.

Just if anyone else has a bad memory when it comes to the tables

Remember to run it as beta, since I use beta functions! (Hotkey: Alt + F5)

```#include <GUIConstants.au3>
#include <GUIEdit.au3>

\$GUIWIDTH = 450
\$GUIHEIGHT = 220

GUICreate("Fraction divide calculator",\$GUIWIDTH,\$GUIHEIGHT)

GUICtrlCreateGroup("First Number",5,10,\$GUIWIDTH-10,70)
\$INPUT1 = GUICtrlCreateInput("0",15,40,50,20,\$ES_NUMBER+\$ES_CENTER)
GUICtrlSetLimit(-1,999999999,-99999999)
GUICtrlSetFont(-1,10,400,0,'Lucida Console')
GUICtrlSetBkColor(-1,0xFFFFFF)

GUICtrlCreateGroup("Second Number",5,90,\$GUIWIDTH-10,70)
\$INPUT2 = GUICtrlCreateInput("0",15,120,50,20,\$ES_NUMBER+\$ES_CENTER)
GUICtrlSetLimit(-1,999999999,-99999999)
GUICtrlSetFont(-1,10,400,0,'Lucida Console')
GUICtrlSetBkColor(-1,0xFFFFFF)

\$CALCULATE = GUICtrlCreateButton("=",15,\$GUIHEIGHT-40,75,25,\$BS_CENTER)
\$EXIT = GUICtrlCreateButton("Exit",\$GUIWIDTH-90,\$GUIHEIGHT-40,75,25,\$BS_CENTER)

\$STATUS1 = GUICtrlCreateLabel("Waiting for number...",100,\$GUIHEIGHT-35,100,15)
\$STATUS2 = GUICtrlCreateLabel("",200,\$GUIHEIGHT-35,100,15)

GUISetState()

While 1
\$msg = GUIGetMsg()
Select
Case \$msg = \$GUI_EVENT_CLOSE Or \$msg = \$EXIT
ExitLoop
Case \$msg = \$CALCULATE
GUICtrlSetState(\$CALCULATE, \$GUI_DISABLE)
GUICtrlSetState(\$EXIT, \$GUI_DISABLE)
GUICtrlSetState(\$INPUT1, \$GUI_DISABLE)
GUICtrlSetBkColor(\$INPUT1,0xFFFFFF)
GUICtrlSetState(\$INPUT2, \$GUI_DISABLE)
GUICtrlSetBkColor(\$INPUT2,0xFFFFFF)
GUICtrlSetData(\$EDIT1,"1 ")
GUICtrlSetData(\$EDIT2,"1 ")
GUICtrlSetData(\$STATUS1,"Checking table:")
GUICtrlSetData(\$STATUS1,"Done!")
GUICtrlSetData(\$STATUS2,"")
GUICtrlSetState(\$CALCULATE, \$GUI_ENABLE)
GUICtrlSetState(\$EXIT, \$GUI_ENABLE)
GUICtrlSetState(\$INPUT1, \$GUI_ENABLE)
GUICtrlSetState(\$INPUT2, \$GUI_ENABLE)
EndSelect
Sleep(10)
WEnd

Func _Calculate(\$num1,\$num2)
For \$tabel = 2 To (\$num1/2) Step 1
GUICtrlSetData(\$STATUS2,\$tabel)
If IsInt(\$num1/\$tabel) = 1 And \$tabel < (\$num2/2) Then
_GUICtrlEdit_AppendText(\$EDIT1,\$tabel&' ')
ElseIf \$tabel > (\$num2/2) Then
\$tabel = (\$num1/2)
EndIf
Next

For \$tabel = 2 To (\$num2/2) Step 1
GUICtrlSetData(\$STATUS2,\$tabel)
If IsInt(\$num2/\$tabel) = 1 And \$tabel < (\$num1/2) Then
_GUICtrlEdit_AppendText(\$EDIT2,\$tabel&' ')
ElseIf \$tabel > (\$num1/2) Then
\$tabel = (\$num2/2)
EndIf
Next
EndFunc```
Edited by Mr. Zero

##### Share on other sites

Very nice I like how it checks all the numbers

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...