mrbloody369 Posted September 16, 2007 Share Posted September 16, 2007 Hi I'm trying to get this little script to work, but it's not having it. I'm haveing issues calling the #'s user enters in the 3 input boxes, then having the func's send that value to a math problem, then having the total displayed to the LabelDisplay. Example: expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 266, 209, 191, 111) $num1 = GUICtrlCreateInput("num1", 16, 24, 33, 21) $num2 = GUICtrlCreateInput("num2", 16, 56, 33, 21) $num3 = GUICtrlCreateInput("num3", 16, 88, 33, 21) $Label1 = GUICtrlCreateLabel("Total", 128, 16, 84, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $LabelDisplay = GUICtrlCreateLabel("00.00", 128, 72, 85, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $CALC = GUICtrlCreateButton("CALC", 32, 144, 75, 25, 0) $EXIT = GUICtrlCreateButton("EXIT", 128, 144, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case $CALC $1 = _num1read() $2 = _num2read() $3 = _num3read() $t = _totalNum() While If Not $1 = 0,'' Or $2 = 0,'' Or $3 = 0,'' Then MsgBox(1,"ERROR","Please end an number from 1~999 in all input boxes") ExitLoop Else $LabelDisplay = $t EndIf WEnd Case $GUI_EVENT_CLOSE, $EXIT Exit EndSwitch WEnd Func _num1read() Switch GUICtrlRead($num1) $nu1 = $n1 EndSwitch Return $n1 EndFunc Func _num2read() Switch GUICtrlRead($num1) $nu2 = $n2 EndSwitch Return $n2 EndFunc Func _num3read() Switch GUICtrlRead($num1) $nu3 = $n3 EndSwitch Return $n3 EndFunc Func _totalNum() $total = $1 + ($2 * 0.2) + ($3 * 0.1) + 50 EndFunc I'm probley going about this compleatly wrong ={, can some one please set me strait?? Mr B. Favorite Quotes"If you apply your mind you can create any thing you can dream of" "Any thing can get done by simply click of a button" Link to comment Share on other sites More sharing options...
martin Posted September 16, 2007 Share Posted September 16, 2007 Hi I'm trying to get this little script to work, but it's not having it. I'm haveing issues calling the #'s user enters in the 3 input boxes, then having the func's send that value to a math problem, then having the total displayed to the LabelDisplay. Example: expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 266, 209, 191, 111) $num1 = GUICtrlCreateInput("num1", 16, 24, 33, 21) $num2 = GUICtrlCreateInput("num2", 16, 56, 33, 21) $num3 = GUICtrlCreateInput("num3", 16, 88, 33, 21) $Label1 = GUICtrlCreateLabel("Total", 128, 16, 84, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $LabelDisplay = GUICtrlCreateLabel("00.00", 128, 72, 85, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $CALC = GUICtrlCreateButton("CALC", 32, 144, 75, 25, 0) $EXIT = GUICtrlCreateButton("EXIT", 128, 144, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case $CALC $1 = _num1read() $2 = _num2read() $3 = _num3read() $t = _totalNum() While If Not $1 = 0,'' Or $2 = 0,'' Or $3 = 0,'' Then MsgBox(1,"ERROR","Please end an number from 1~999 in all input boxes") ExitLoop Else $LabelDisplay = $t EndIf WEnd Case $GUI_EVENT_CLOSE, $EXIT Exit EndSwitch WEnd Func _num1read() Switch GUICtrlRead($num1) $nu1 = $n1 EndSwitch Return $n1 EndFunc Func _num2read() Switch GUICtrlRead($num1) $nu2 = $n2 EndSwitch Return $n2 EndFunc Func _num3read() Switch GUICtrlRead($num1) $nu3 = $n3 EndSwitch Return $n3 EndFunc Func _totalNum() $total = $1 + ($2 * 0.2) + ($3 * 0.1) + 50 EndFunc I'm probley going about this compleatly wrong ={, can some one please set me strait?? Mr B. Sorry I haven't got much time to explain but here is a very hacked around version of your script. expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 266, 209, 191, 111) $num1 = GUICtrlCreateInput("num1", 16, 24, 33, 21) $num2 = GUICtrlCreateInput("num2", 16, 56, 33, 21) $num3 = GUICtrlCreateInput("num3", 16, 88, 33, 21) $Label1 = GUICtrlCreateLabel("Total", 128, 16, 84, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $LabelDisplay = GUICtrlCreateLabel("00.00", 128, 72, 85, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $CALC = GUICtrlCreateButton("CALC", 32, 144, 75, 25, 0) $EXIT = GUICtrlCreateButton("EXIT", 128, 144, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case $CALC $1 = GUICtrlRead($num1);_num1read() $2 = GUICtrlRead($num2);_num2read() $3 = GUICtrlRead($num3);_num3read() If $1 = 0 Or $2 = 0 Or $3 = 0 Then MsgBox(1,"ERROR","Please end an number from 1~999 in all input boxes") ;ExitLoop Else $t = _totalNum() GUICtrlSetData($LabelDisplay,$t) EndIf Case $GUI_EVENT_CLOSE, $EXIT Exit EndSwitch WEnd Func _totalNum() $total = $1 + ($2 * 0.2) + ($3 * 0.1) + 50 Return $total EndFunc You need to spend more time reading the help file and trying out the examples. Best to run the examples and try modifying them to get an understanding of how things work in AutoIt. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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