PantZ4 Posted October 10, 2007 Share Posted October 10, 2007 (edited) 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)expandcollapse popup#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) $EDIT1 = GUICtrlCreateEdit("",70,30,$GUIWIDTH-90,40,$WS_HSCROLL+$ES_READONLY) 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) $EDIT2 = GUICtrlCreateEdit("",70,110,$GUIWIDTH-90,40,$WS_HSCROLL+$ES_READONLY) 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:") _Calculate(GUICtrlRead($INPUT1),GUICtrlRead($INPUT2)) 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 October 10, 2007 by Mr. Zero Link to comment Share on other sites More sharing options...
Nahuel Posted October 10, 2007 Share Posted October 10, 2007 Very nice I like how it checks all the numbers 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