daohieu61 Posted August 20, 2016 Share Posted August 20, 2016 I want to write a script that read thing in a textbox and use the text to calculate "a2 " but instead of reading only one number, i want the script to read several numbers seperated by semicolon ";" or comma "," and show the result by execute the script with each numbers sequentially . This is the example script: Global $Form1 = GUICreate("Test", 250, 137, 181, 124) Global $Label1 = GUICtrlCreateLabel("Number", 18, 44, 45, 27) Global $Input1 = GUICtrlCreateInput("a", 88, 42, 60, 21) Global $Solve = GUICtrlCreateButton("Solve", 160, 42, 80, 17) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $Solve Equation(GUICtrlRead($Input1)) EndSwitch WEnd Func Equation($example) $a= $example^2 MsgBox ( 48, "solution", "The solution of " & $example & "^2 is " & $a) EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted August 20, 2016 Developers Share Posted August 20, 2016 Something like this: Global $Form1 = GUICreate("Test", 250, 137, 181, 124) Global $Label1 = GUICtrlCreateLabel("Number", 18, 44, 45, 27) Global $Input1 = GUICtrlCreateInput("a", 88, 42, 60, 21) Global $Solve = GUICtrlCreateButton("Solve", 160, 42, 80, 17) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $Solve $result = StringSplit(GUICtrlRead($Input1),",;") for $x = 1 to $result[0] Equation($result[$x]) Next EndSwitch WEnd Func Equation($example) $a= $example^2 MsgBox ( 48, "solution", "The solution of " & $example & "^2 is " & $a) EndFunc Jos daohieu61 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
daohieu61 Posted August 20, 2016 Author Share Posted August 20, 2016 3 minutes ago, Jos said: Something like this: Global $Form1 = GUICreate("Test", 250, 137, 181, 124) Global $Label1 = GUICtrlCreateLabel("Number", 18, 44, 45, 27) Global $Input1 = GUICtrlCreateInput("a", 88, 42, 60, 21) Global $Solve = GUICtrlCreateButton("Solve", 160, 42, 80, 17) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $Solve $result = StringSplit(GUICtrlRead($Input1),",;") for $x = 1 to $result[0] Equation($result[$x]) Next EndSwitch WEnd Func Equation($example) $a= $example^2 MsgBox ( 48, "solution", "The solution of " & $example & "^2 is " & $a) EndFunc Jos Thank you very much. I have a script with a bigger input box but my text is alway show on first line. I want it to auto word wrap (like word) but i don't know how to do. Can you help me again pls? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 20, 2016 Developers Share Posted August 20, 2016 Sure, that shouldn't be that difficult: #include <EditConstants.au3> Global $Form1 = GUICreate("Test", 250, 137, 181, 124) Global $Label1 = GUICtrlCreateLabel("Number", 18, 44, 45, 27) Global $Input1 = GUICtrlCreateEdit("a", 88, 42, 120, 60,$ES_MULTILINE) Global $Solve = GUICtrlCreateButton("Solve", 160, 112, 80, 17) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $Solve $result = StringSplit(GUICtrlRead($Input1),",;") for $x = 1 to $result[0] Equation($result[$x]) Next EndSwitch WEnd Func Equation($example) $a= $example^2 MsgBox ( 48, "solution", "The solution of " & $example & "^2 is " & $a) EndFunc Jos PS:No need to qoute my post as we can see what I wrote already daohieu61 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
daohieu61 Posted August 20, 2016 Author Share Posted August 20, 2016 Thank you very much 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