Jump to content

RadioButton Click import to var


Recommended Posts

hi guys,

I need some assistance in getting a code to work. In a nutshell what I'm trying to do is to have 2 radio buttons embedded in an existing group.

Both the radio buttons would lead to separate choices in the main program.

Post radio button selection, my intent is to have the value stored in a var & then get it imported to a .vbs script which i'll further utilize during windows deployment using TSenv.

Apologies for not being able to share the entire code as that would not be to do, hope you'll will understand.

many thanks in advance.

cheers...

Link to comment
Share on other sites

Clarify what you need and you might get some help.

So far all I can get from your initial post is that you have 2 radio buttons that enable unknown things to happen in your script. You need to store some kind of information into a variable, but you don't say what information you want. You further need this unknown information to be passed to an unknown VBScript to do something equally unknown with that information. Have I got it right so far?

Read your first post as if you have no fracking clue what the poster wants, and YOU try and figure out how to help him. Once you figure out how to post your question in a manner so that someone with no knowledge of your current script(s) can tell exactly what you need to do, please update your post before bumping again.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanks BrewManNH. does this help a bit...

 

 
In the GUI Code, here's how the radio button looks like--
 
GUICtrlSetFont(-1, 10, 400, 0, "GUIFont")
$OSConfig = GUICtrlCreateLabel("OS Config:", 16, 312, 69, 17)
GUICtrlSetFont(-1, 8, 400, 0, "GUIFont")
$OS1 = GUICtrlCreateButton("Select OS 1", 110, 312, 129, 25)
$OS2 = GUICtrlCreateButton("Select OS 2", 280, 312, 129, 25)
 
 
 
snip from the Function--
 
 
; Run the GUI until the dialog is closed
While 1
; Check for a valid computername (a-z, A-Z, 0-9 and 1-15 characters long)
If (IsValidComputerName(GUICtrlRead($ComputerName))) Then
GUICtrlSetState($Finish, $GUI_ENABLE)
$FinnishIsDisabled = False
ElseIf (Not IsValidComputerName(GUICtrlRead($ComputerName))) Then
GUICtrlSetState($Finish, $GUI_DISABLE)
 
EndIf
 
$msg  = GUIGetMsg()
$msg1 = GUIGetMsg()
$msg2 = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg1 = $OS
GUISetState(@SW_SHOWNA)
$strOS = GUICtrlRead($OS)
Case $msg2 = $OS2
GUISetState(@SW_SHOWNA)
$strOS2 = GUICtrlRead($OS2)
Case $msg = $Finish
GUISetState(@SW_HIDE)
$strOSDComputerName = GUICtrlRead($ComputerName)
$strUserNameTSVariable = $UserTSVariable
$strUserName = GUICtrlRead($UserNameEdit)
ExitLoop
 
Case $msg = $ComputerNameEdit
If GUICtrlRead($ComputerNameEdit) = 1 Then
GUICtrlSetState($ComputerName, $GUI_ENABLE)
Else
GUICtrlSetState($ComputerName, $GUI_DISABLE)
EndIf
 EndSelect
WEnd
 
from Import to VBS--
 
FileWriteLine($OutFile, "Set TSEnv = CreateObject(" & Chr(34) & "Microsoft.SMS.TSEnvironment" & Chr(34) & ")")
FileWriteLine($OutFile, "")
FileWriteLine($OutFile, Chr(39) & " Write Task Sequence Variables")
FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OSDComputerName" & Chr(34) & ") = " & Chr(34) & $strOSDComputerName & Chr(34))
FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OS1" & Chr(34) & ") = " & Chr(34) & $strOS1 & Chr(34))
FileWriteLine($OutFile, "TSEnv(" & Chr(34) & "OS2" & Chr(34) & ") = " & Chr(34) & $strOS2 & Chr(34))
 
thank you!
Link to comment
Share on other sites

Once, the .exe is executed, this will generate a .vbs, something like this--

 
Dim TSEnv
 
' Connect to Task Sequence
Set TSEnv = CreateObject("Microsoft.SMS.TSEnvironment")
 
' Write Task Sequence Variables
TSEnv("OSDComputerName") = "MYLaptop"
 
 
Similar to this variable, I'd want the other 2 variables (OS1 or OS2 whichever user selects) imported in this .vbs output so I use that logic further in my deployments.
Link to comment
Share on other sites

I think I see the error, although I'm not 100% sure because I still don't know what your actual problem is.

$OS1 = GUICtrlCreateButton("Select OS 1", 110, 312, 129, 25)
$OS2 = GUICtrlCreateButton("Select OS 2", 280, 312, 129, 25)
Case $msg = $OS ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< should this be $OS1 and not $OS?
Case $msg = $OS2

Also this is entirely unnecessary and probably causing issues all by itself.

$msg  = GUIGetMsg()
$msg1 = GUIGetMsg()
$msg2 = GUIGetMsg()

Use one call to GUIGetMsg and then use that one call to check to see which control was actioned.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...