Remember radio button selection for different users & open the browser RRS feed

  • Question

  • Hello,

    I have a "working" HTA code but i'd like to add the following into the script , but i cannot manage it to work.
    I'd like to select for each website wich browser i want to use.

    - How to remember the selection of the radio buttons for different users? The location of the script is shared
      If my wife enter this page, the script should auto load here preference radio button settings & so on ..
      I thought by looking of the name of the user in windows to check who is using the script.

    - If you select the first radio button (Internet Explorer) , the website behind the button should be open with IE.
      If you select the "Chrome" radio button , the website behind this button should be open with Chrome

    If someone could help me .... i'm searching for days now :(


                            'Internet Explorer
                            Sub iExplorer(url)
                                set shell = createobject("")
                                shell.Run "iexplore " & url
                            'Google Chrome
                            Sub chrome(url)
                                set shell = createobject("")
                                shell.Run "chrome.exe " & url

                <inputtype="radio" name="RadioButton1" ID="RadioButton2" value="iExplorer">Internet Explorer
                <inputtype="radio" name="RadioButton1" ID="RadioButton2" value="Chrome">Chrome            
                    <inputtype='button' class='textfield' value='Wikipedia' onclick='iExplorer("")'><br>
                <inputtype="radio" name="RadioButton2" ID="RadioButton2" value="iExplorer">Internet Explorer
                <inputtype="radio" name="RadioButton2" ID="RadioButton2" value="Chrome">Chrome        
                    <inputtype='button' class='textfield' value='   Google   ' onclick='iExplorer("")'><br>
                <inputtype="radio" name="RadioButton3" ID="RadioButton2" value="iExplorer">Internet Explorer
                <inputtype="radio" name="RadioButton3" ID="RadioButton2" value="Chrome">Chrome            
                <inputtype='button' class='textfield' value='Facebook' onclick='iExplorer("")'><br>

    Saturday, November 16, 2019 12:29 PM

All replies

  • Hi Skeleton32,

    You can take a reference of the following code to get the username:

    <script language="vbscript">
    	Sub GetUserName()
    		Set WshNetwork = CreateObject("WScript.Network")	
    		Dim GetUser
    		GetUser = WshNetwork.UserName 
    		Set WshNetwork = Nothing
    		user.innerHTML = "<p>" & GetUser & "</p>"
    	End Sub
    <div id="user">
        <script Language="VBScript">

    And you can save the data to a file to remember the selection of the radio buttons

    Const ForWriting = 2
    Dim objFSO, objFile, strFileName
    strFileName = "textfile.txt"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(strFileName, ForWriting, true)
    Set objShell = CreateObject("WScript.Shell")
    Sub SubmitValue
          datastring = input.Value
          objFile.Write datastring & vbCRLF
    End Sub

    Hope it helps and please feel free to talk with us if you have further issue. 

    Best Regards,

    Baker Kong

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    SharePoint Server 2019 has been released, you can click  here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, November 18, 2019 4:11 AM