notprodigy Posted July 13, 2010 Share Posted July 13, 2010 (edited) Okay, i seem to be having some trouble with a small bit of code. basically i just have a small GUI with a combo box, and you pick a number from the combo box and hit the 'go' button. it works, but i dont know how to make it read the value from the combo box here is the part that is giving me trouble MsgBox(0, "Beta", "Click 'Okay', And I'll tell you what you put!") MsgBox(0, "Info", "You Picked " & $Combo1.????????) Edited July 13, 2010 by notprodigy Link to comment Share on other sites More sharing options...
enaiman Posted July 13, 2010 Share Posted July 13, 2010 Always, always ... GUICtrlRead SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
notprodigy Posted July 13, 2010 Author Share Posted July 13, 2010 C:\Program Files (x86)\AutoIt3\random.au3 (29) : ==> Variable must be of type "Object".: MsgBox(0, "Info", "You Picked " & $Combo1.GUICtrlRead) MsgBox(0, "Info", "You Picked " & $Combo1^ ERROR Link to comment Share on other sites More sharing options...
Maximus1 Posted July 13, 2010 Share Posted July 13, 2010 use anything like this FileWriteLine("test.opt", "" & GUICtrlRead($Items)) this piece writes a line with the data in $Items into the file test.opt. Link to comment Share on other sites More sharing options...
notprodigy Posted July 13, 2010 Author Share Posted July 13, 2010 use anything like this FileWriteLine("test.opt", "" & GUICtrlRead($Items)) this piece writes a line with the data in $Items into the file test.opt. ahhh thank you! MsgBox(0, "Beta", "Click 'Okay', And I'll tell you what you put!") MsgBox(0, "Info", "You Picked " & GUICtrlRead($Combo1)) that works perfectly. Hats off to you! Link to comment Share on other sites More sharing options...
Maximus1 Posted July 13, 2010 Share Posted July 13, 2010 no problem i actualy know how hard it can be as newbe. :-D Link to comment Share on other sites More sharing options...
notprodigy Posted July 13, 2010 Author Share Posted July 13, 2010 (edited) one more small little question. how can i divide a number? like, i have a sleep in miliseconds, and i want to say like $time = GUICtrlRead($Input3) / 1000 MsgBox (0,"I will sleep for " & $time & " seconds") doesnt work, although i cant see whats wrong with it. Help appreciated! edit, there was no shortcuts here, i had to do this the long way MsgBox (0,"I will sleep for " & GUICtrlRead($Input3)/1000 & " seconds") works fine. Edited July 13, 2010 by notprodigy Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 13, 2010 Share Posted July 13, 2010 (edited) Are you completely wacky or something? This: $time = GUICtrlRead($Input3) / 1000 MsgBox (0,"I will sleep for " & $time & " seconds") And This: MsgBox (0,"I will sleep for " & GUICtrlRead($Input3)/1000 & " seconds") Is exactly the same thing, but neither work! Don't you actually try your code before posting? Both give "ERROR: MsgBox() [built-in] called with wrong number of args.", but that should be obvious how to fix. Then which one you use is up to you. Edited July 13, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
notprodigy Posted July 13, 2010 Author Share Posted July 13, 2010 (edited) Are you completely wacky or something? This: $time = GUICtrlRead($Input3) / 1000 MsgBox (0,"I will sleep for " & $time & " seconds") And This: MsgBox (0,"I will sleep for " & GUICtrlRead($Input3)/1000 & " seconds") Is exactly the same thing, but neither work! Don't you actually try your code before posting? Both give "ERROR: MsgBox() [built-in] called with wrong number of args.", but that should be obvious how to fix. Then which one you use is up to you. If GUICtrlRead($Input1) < 60000 then MsgBox(0, "Info", "Delay is currently set to " & GUICtrlRead($Input1)/1000 & " second(s)") else MsgBox(0, "Info", "Delay is currently set to " & GUICtrlRead($Input1)/60000 & " minute(s)") endif using 10000 for the first one and 300000 for the second. the error you get is because i wrote that code in like 4 seconds off the top of my head and it is missing the title of the message box MsgBox (0,"TITLE OF MESSAGE BOX", "I will sleep for " & $time & " seconds") Edited July 13, 2010 by notprodigy 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