Function Associate2($extension,$opencmd)

    Dim $rc

    ;Make sure the dot is specified.
    If Left($extension, 1) <> "."
        $extension = "." + $extension
    EndIf
    ;Exit if a required parameter is empty.
    Select
        Case $extension = ""
            Exit 87
        Case $opencmd = ""
            Exit 87
    EndSelect

    ;Create the values for the open command.
    $rc = WriteValue("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" + $extension + "\", "Application", $opencmd, "REG_SZ")
EndFunction

Associate2(".kix","Notepad.exe")

Associate2(".WhateverExtensionName","WhateverApplication.exe")