HaNdLoRdz Posted November 27, 2010 Share Posted November 27, 2010 sorry for my bad english, im a newbie in AUTOIT. i want to make some program,,but i got trouble with read data from inputbox. here is my code: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> Opt("TrayOnEventMode", 1) ;Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("V.1.1", 237, 335, 192, 114) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") $Label1 = GUICtrlCreateLabel("Time : ", 8, 56, 36, 17) $Label2 = GUICtrlCreateLabel("Post : ", 8, 98, 34, 17) $input1 = GUICtrlCreateInput("", 48, 52, 41, 21) guictrlsetstate($input1,$GUI_DISABLE) $input2 = GUICtrlCreateInput("", 48, 95, 41, 21) guictrlsetstate($input2,$GUI_DISABLE) $Label3 = GUICtrlCreateLabel("Minute", 93, 56, 36, 17) $Label4 = GUICtrlCreateLabel("Post", 93, 100, 36, 17) $Label9 = GUICtrlCreateLabel("The Number is = ", 10, 320, 200, 27) $Settings = GUICtrlCreateGroup("Settings : ", 0, 32, 137, 89, -1, $WS_EX_TRANSPARENT) GUICtrlCreateGroup("", -99, -99, 1, 1) $OR = GUICtrlCreateLabel("OR", 58, 76, 22, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;;; radio $Radio1 = GUICtrlCreateRadio("By Time", 0, 8, 57, 17) $Radio2 = GUICtrlCreateRadio("By Post", 80, 8, 57, 17) ;;TOMBOL start $Button1 = GUICtrlCreateButton("START", 4, 128, 129, 17) ;;tombol stop $Button2 = GUICtrlCreateButton("STOP", 4, 152, 129, 17) ;tombol hide $Button3 = GUICtrlCreateButton("Hide To Tray", 4, 176, 129, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() if $nmsg = -3 then Exit if $nmsg = $Radio1 then time() if $nmsg = $Radio2 then post() if $nmsg = $Button1 then Start() WEnd func Start() $read1 = GUICtrlRead($input1) $read2 = GUICtrlRead($input2) if $input1 = True Then GUICtrlSetData($Label9,"The Number in Inputbox1 = " & $read1) sleep(20) ;EndIf Else $input2 = True Then GUICtrlSetData($Label9,"The Number in Inputbox1 = " & $read2) sleep(20) ;MsgBox(0,"",$read2) ;EndIf EndIf EndFunc func post() GUICtrlSetState($input2,$GUI_ENABLE) guictrlsetstate($input1,$GUI_DISABLE) EndFunc func time() GUICtrlSetState($input1,$GUI_ENABLE) guictrlsetstate($input2,$GUI_DISABLE) EndFunc func _quit() Exit EndFunc anyone can help me to fix this??? i just want to read data from the active inputbox. could be???? thx for the help, n sorry again for my poor english. Link to comment Share on other sites More sharing options...
saywell Posted November 27, 2010 Share Posted November 27, 2010 (edited) Hi, it looks like both your inputs are disabled. Also, after $Button1 = GUICtrlCreateButton("START", 4, 128, 129, 17) you need to add a line like GUICtrlSetOnEvent($Button1, "Start") when in oneventmode to tell the script what function to run when the button is clicked. And the same for the other button [well, not quite the same, but with the button id and function to be called changed!] Also you dont need the $msg stuff at the end - thats for message loop mode. Look at the GUI Reference section in the helpfile. William [edit] - didn't notice that oneventmode was commented out - ignore above unless you want to use that mode! Edited November 27, 2010 by saywell Link to comment Share on other sites More sharing options...
JohnOne Posted November 27, 2010 Share Posted November 27, 2010 $input1 is not a boolean, its a handle if you replace it with if not ($read1 == "") Then it may work, same with input2 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
HaNdLoRdz Posted November 27, 2010 Author Share Posted November 27, 2010 hmm...in my mind i want to make the program run like this : 1. when i tick on Radio1 then inputbox1 is enable n inputbox2 is disable 2. when i tick on radio2 then inputbox2 is enable n inputbox1 is disable 3. when radio1 got tick (inputbox1 enable) i want to read data from that inputbox, i press START button n label9 will write the data from inputbox1 4. when radio2 got tick (inputbox2 enable) i want to read data from that inputbox, i press START button too n label9 will write the data from inputbox2 arghhhh.,.,.,im so confuse...pls help me out... Link to comment Share on other sites More sharing options...
JohnOne Posted November 27, 2010 Share Posted November 27, 2010 Well what happened when you tried what I suggested? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted November 27, 2010 Share Posted November 27, 2010 (edited) Replace your function with this one, see if that works out. Func Start()<br> If GUICtrlRead($input1) <> "" Then GUICtrlSetData($Label9,"The Number in Inputbox1 = " & GUICtrlRead($input1))<br> Sleep(20)<br> If GUICtrlRead($input2) <> "" Then GUICtrlSetData($Label9,"The Number in Inputbox2 = " & GUICtrlRead($input2))<br>EndFunc This suggestion is pretty much the same as JohnOne's, so I would definately suggest you try either. Edited November 27, 2010 by somdcomputerguy - 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...
somdcomputerguy Posted November 27, 2010 Share Posted November 27, 2010 Func Start() If GUICtrlRead($input1) <> "" Then GUICtrlSetData($Label9,"The Number in Inputbox1 = " & GUICtrlRead($input1)) Sleep(20) If GUICtrlRead($input2) <> "" Then GUICtrlSetData($Label9,"The Number in Inputbox2 = " & GUICtrlRead($input2)) EndFunc - 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...
HaNdLoRdz Posted November 28, 2010 Author Share Posted November 28, 2010 ohhh thx JohnOne n Somdcomputerguy..ur help so much mean to me....its work,but just still error little bit.when i try to put data in $input1 --->label9 read it perfectly, n after i try to enable the $input2--->label9 read perfectly too,but when i try back to read back $Input1,they will not change anymore..so i must close the program but thanks,at least i got a enlightment,.,LOL 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