myksharma Posted June 17, 2014 Posted June 17, 2014 Hey everyone. looking for some quick answer to this-- I'm using couple of radio buttons created via GUICtrlCreateRadio function. My intent is to have one of those selected by default upon program launch, can this be achieved & if yes, how. thanks in advance..
saudumm Posted June 17, 2014 Posted June 17, 2014 You'd have to set the state of the Radio Button Here is an example from the help file: Local $idRadio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 120, 20) GUICtrlSetState($idRadio2, $GUI_CHECKED)
myksharma Posted June 17, 2014 Author Posted June 17, 2014 Thanks Saudumm. this works fine however I'm importing the radio button selection as a variable in a .vbs script that executes after my program finishes. Now, the program has radio button#2 selected as default however when I directly finish the program, it doesn't show me the value of radio button#2 in the .vbs script. If I select radio button#1 then it works as expected.
JohnOne Posted June 17, 2014 Posted June 17, 2014 Post example script including vbs. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
myksharma Posted June 17, 2014 Author Posted June 17, 2014 Koda Section-- $OS = GUICtrlCreateRadio("Select OS Only", 110, 312, 129, 25) GUICtrlSetFont(-1, 10, 800, 0, $GUIFont) $OSPlusApps = GUICtrlCreateRadio("Select OS & Apps", 280, 312, 129, 25) GUICtrlSetFont(-1, 10, 800, 0, $GUIFont) GUICtrlSetState($OSPlusApps, $gui_checked) From the function-- $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $OS $strOS = True $strOSPlusApps = False Case $msg = $OSPlusApps $strOSPlusApps = True $strOS = False Vbs filewrite-- IF $strOS Then FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSOnly" & Chr(34) & ") = " & Chr(34) & $strOS & Chr(34)) IF $strOS Then FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSWithApps" & Chr(34) & ") = " & Chr(34) & $strOSPlusApps & Chr(34)) IF $strOSPlusApps Then FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSWithApps" & Chr(34) & ") = " & Chr(34) & $strOSPlusApps & Chr(34)) IF $strOSPlusApps Then FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSOnly" & Chr(34) & ") = " & Chr(34) & $strOS & Chr(34))
saudumm Posted June 17, 2014 Posted June 17, 2014 Please try this Vbs Filewrite. It checks the State of your Radio Buttons, sets the variables and writes to your vbs-file. Switch $GUI_CHECKED Case GUICtrlRead($OS) $strOS = True $strOSPlusApps = False Case GUICtrlRead($OSPlusApps) $strOS = False $strOSPlusApps = True EndSwitch FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSOnly" & Chr(34) & ") = " & Chr(34) & $strOS & Chr(34)) FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSWithApps" & Chr(34) & ") = " & Chr(34) & $strOSPlusApps & Chr(34))
myksharma Posted June 17, 2014 Author Posted June 17, 2014 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Switch $GUI_CHECKED Case GUICtrlRead($OS) $strOS = True $strOSPlusApps = False Case GUICtrlRead($OSPlusApps) $strOS = False $strOSPlusApps = True EndSwitch ;Case $msg = $OS ;$strOS = True ;$strOSPlusApps = False ;Case $msg = $OSPlusApps ;$strOSPlusApps = True ; $strOS = False Case $msg = $Finish It didn't enumerate the results in the .vbs output-- TSEnv("OSOnly") = "" TSEnv("OSWithApps") = ""
Solution saudumm Posted June 17, 2014 Solution Posted June 17, 2014 (edited) You have to put my Switch-Statement outside of your Select-Statement just before your Filewriteline. Something like this: $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Finish ;Something else EndSelect Switch $GUI_CHECKED Case GUICtrlRead($OS) $strOS = True $strOSPlusApps = False Case GUICtrlRead($OSPlusApps) $strOS = False $strOSPlusApps = True EndSwitch Could you please post more of your code or pm it to me, if you don't want it to be made public? Edited June 17, 2014 by saudumm
myksharma Posted June 17, 2014 Author Posted June 17, 2014 thank you so much saudumm.. this really added the needed logic to my program. thanks again.
saudumm Posted June 17, 2014 Posted June 17, 2014 thank you so much saudumm.. this really added the needed logic to my program. thanks again. I'm glad I could help.
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