patiii Posted July 12, 2011 Share Posted July 12, 2011 hi people i've got a little problem this is my script #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Patrick Becker\Desktop\Form1.kxf $Form1 = GUICreate("Form1", 573, 222, 212, 129) $Input1 = GUICtrlCreateInput("", 40, 32, 65, 21) $xKoordinate1 = GUICtrlCreateLabel("xKoordinate1", 40, 0, 66, 17) $OK = GUICtrlCreateButton("OK", 120, 32, 25, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK $xKoordinate1 = GUICtrlRead($Input1) EndSwitch WEnd MsgBox(0,"",$xKoordinate1) so i've got an inputbox and a button i want to write a number into the inputbox and after i pressed the button a msgbox should appear with the number as the text... please help me i don't know where my mistake is thanks for every help patiii Link to comment Share on other sites More sharing options...
hannes08 Posted July 12, 2011 Share Posted July 12, 2011 Well, if you'll put your MsgBox just after the "GUICtrlRead()" it will certainly work. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
patiii Posted July 12, 2011 Author Share Posted July 12, 2011 (edited) oh yeah you are right.. the answer is sometimes really easy thanks for your help but thats not the whole programm.. so i can not use it after the endswitch as a varibale? because i just want to save the number in the variavle and then a want to use it with other thinks , but i think then it should not be under the case button function so this is my whole programm #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Patrick Becker\Desktop\Form1.kxf $Form1 = GUICreate("Form1", 573, 222, 212, 129) $Input1 = GUICtrlCreateInput("", 40, 32, 65, 21) $Input2 = GUICtrlCreateInput("", 184, 32, 65, 21) $Input3 = GUICtrlCreateInput("", 320, 32, 65, 21) $Input4 = GUICtrlCreateInput("", 464, 37, 65, 21) $Input5 = GUICtrlCreateInput("", 32, 88, 65, 21) $Input6 = GUICtrlCreateInput("", 192, 96, 65, 21) $Input7 = GUICtrlCreateInput("", 320, 104, 65, 21) $Input8 = GUICtrlCreateInput("", 472, 112, 65, 21) $Input9 = GUICtrlCreateInput("", 40, 160, 65, 21) $Input10 = GUICtrlCreateInput("", 192, 168, 65, 21) $Input11 = GUICtrlCreateInput("", 328, 168, 65, 21) $Input12 = GUICtrlCreateInput("", 472, 176, 65, 21) $xKoordinate1 = GUICtrlCreateLabel("xKoordinate1", 40, 0, 66, 17) $xKoordinate2 = GUICtrlCreateLabel("xKoordinate2", 40, 64, 66, 17) $xKoordinate3 = GUICtrlCreateLabel("xKoordinate3", 40, 128, 66, 17) $yKoordinate1 = GUICtrlCreateLabel("yKoordinate1", 192, 8, 66, 17) $yKoordinate2 = GUICtrlCreateLabel("yKoordinate2", 192, 64, 66, 17) $yKoordinate3 = GUICtrlCreateLabel("yKoordinate3", 192, 136, 66, 17) $zKoordinate1 = GUICtrlCreateLabel("zKoordinate1", 328, 8, 66, 17) $zKoordinate2 = GUICtrlCreateLabel("zKoordinate2", 320, 72, 66, 17) $zKoordinate3 = GUICtrlCreateLabel("zKoordinate3", 328, 136, 66, 17) $Ergebniss1 = GUICtrlCreateLabel("Ergebniss1", 472, 16, 56, 17) $Ergebniss2 = GUICtrlCreateLabel("Ergebniss2", 472, 72, 56, 17) $Ergebniss3 = GUICtrlCreateLabel("Ergebniss3", 472, 144, 56, 17) $OK = GUICtrlCreateButton("OK", 120, 32, 25, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK $xKoordinate1 = GUICtrlRead($Input1) MsgBox(0,"",$xKoordinate1) EndSwitch WEnd MsgBox(0,"",$xKoordinate1) $xKoordinate1 = $x1 $yKoordinate1 = $y1 $zKoordinate1 = $z1 $Ergebniss1 = $e1 $xKoordinate2 = $x2 $yKoordinate2 = $y2 $zKoordinate2 = $z2 $Ergebniss2= $e2 $xKoordinate3 = $x3 $yKoordinate3 = $y3 $zKoordinate3 = $z3 $Ergebniss3 = $e3 If $x1 = 0 then MsgBox(0, "Information","Die erste x-Koordinate darf nicht Null sein , da man sonst durch Null teilt!") i want to save the numbers in different variables and then i want to use them all... do you know what i mean? Edited July 12, 2011 by patiii Link to comment Share on other sites More sharing options...
Rigest Posted July 12, 2011 Share Posted July 12, 2011 I don't really understand what you are trying at the end. But only the part between Case $ok and endswitch is executed. And you can use [autoit.] [/autoit.] (without the .) to display your Autoit code. Link to comment Share on other sites More sharing options...
patiii Posted July 12, 2011 Author Share Posted July 12, 2011 i think it's a bit too difficult to explain what the programm is for... it's something for maths and i'm triying to solute it with i programm so it is easier... but my question is: between the case auf $ok and the switch end the programm is right you sad... but can't i use $xKoordinate1 (thats what i tipped into the inputbox) also aufter the switchend ? because i need to use $xKoordinate1 after the koda part so after the Wend ... Link to comment Share on other sites More sharing options...
Rigest Posted July 12, 2011 Share Posted July 12, 2011 i think it's a bit too difficult to explain what the programm is for... it's something for maths and i'm triying to solute it with i programm so it is easier... but my question is: between the case auf $ok and the switch end the programm is right you sad... but can't i use $xKoordinate1 (thats what i tipped into the inputbox) also aufter the switchend ? because i need to use $xKoordinate1 after the koda part so after the Wend ... You can make a seperate function for that if you want. I've changed the last part of your script into a function below. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Patrick Becker\Desktop\Form1.kxf $Form1 = GUICreate("Form1", 573, 222, 212, 129) $Input1 = GUICtrlCreateInput("", 40, 32, 65, 21) $Input2 = GUICtrlCreateInput("", 184, 32, 65, 21) $Input3 = GUICtrlCreateInput("", 320, 32, 65, 21) $Input4 = GUICtrlCreateInput("", 464, 37, 65, 21) $Input5 = GUICtrlCreateInput("", 32, 88, 65, 21) $Input6 = GUICtrlCreateInput("", 192, 96, 65, 21) $Input7 = GUICtrlCreateInput("", 320, 104, 65, 21) $Input8 = GUICtrlCreateInput("", 472, 112, 65, 21) $Input9 = GUICtrlCreateInput("", 40, 160, 65, 21) $Input10 = GUICtrlCreateInput("", 192, 168, 65, 21) $Input11 = GUICtrlCreateInput("", 328, 168, 65, 21) $Input12 = GUICtrlCreateInput("", 472, 176, 65, 21) $xKoordinate1 = GUICtrlCreateLabel("xKoordinate1", 40, 0, 66, 17) $xKoordinate2 = GUICtrlCreateLabel("xKoordinate2", 40, 64, 66, 17) $xKoordinate3 = GUICtrlCreateLabel("xKoordinate3", 40, 128, 66, 17) $yKoordinate1 = GUICtrlCreateLabel("yKoordinate1", 192, 8, 66, 17) $yKoordinate2 = GUICtrlCreateLabel("yKoordinate2", 192, 64, 66, 17) $yKoordinate3 = GUICtrlCreateLabel("yKoordinate3", 192, 136, 66, 17) $zKoordinate1 = GUICtrlCreateLabel("zKoordinate1", 328, 8, 66, 17) $zKoordinate2 = GUICtrlCreateLabel("zKoordinate2", 320, 72, 66, 17) $zKoordinate3 = GUICtrlCreateLabel("zKoordinate3", 328, 136, 66, 17) $Ergebniss1 = GUICtrlCreateLabel("Ergebniss1", 472, 16, 56, 17) $Ergebniss2 = GUICtrlCreateLabel("Ergebniss2", 472, 72, 56, 17) $Ergebniss3 = GUICtrlCreateLabel("Ergebniss3", 472, 144, 56, 17) $OK = GUICtrlCreateButton("OK", 120, 32, 25, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK $xKoordinate1 = GUICtrlRead($Input1) MsgBox(0,"",$xKoordinate1) thisisafunction ($xKoordinate1) EndSwitch WEnd Func thisisafunction ($xKoordinate1) MsgBox(0,"",$xKoordinate1) $xKoordinate1 = $x1 $yKoordinate1 = $y1 $zKoordinate1 = $z1 $Ergebniss1 = $e1 $xKoordinate2 = $x2 $yKoordinate2 = $y2 $zKoordinate2 = $z2 $Ergebniss2= $e2 $xKoordinate3 = $x3 $yKoordinate3 = $y3 $zKoordinate3 = $z3 $Ergebniss3 = $e3 $returnvariable Return $returnvariable Endfunc Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 12, 2011 Share Posted July 12, 2011 Basically, in your code there is no way out of the While loop except to Exit the script.. - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
patiii Posted July 12, 2011 Author Share Posted July 12, 2011 (edited) thank you Rigest that was what i am looking for... i hope i can do the rest on my own EDIT: i have got one more question i said it is a programm for maths.. so in the end i want do to something like $xKoordinate1 : $xKoordinate2 = $new$xKoordinate something like that.. but how can i use 2 varibales in one function? because in the example you explained it that i have to do a function for every time i want to use the varible right? patiii Edited July 12, 2011 by patiii Link to comment Share on other sites More sharing options...
Rigest Posted July 12, 2011 Share Posted July 12, 2011 You can add as many variables as you want in a function. You have to give them as parameters for the function, e.g. Func ($variable1, $variable2 etc.). I suggest that you take some more time reading the tutorials. This is pretty basic stuff and you really have to understand these functions. Furthermore, a lot of your questions can be awnsered in the helpfile of Autoit. Goodluck Link to comment Share on other sites More sharing options...
patiii Posted July 12, 2011 Author Share Posted July 12, 2011 okay thanks i think i got it 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