Como faço para alterar o IE Html Editor padrão para o Notepad2 no Windows 7

0

para que, quando eu visualizar a fonte, seja o notepad2 que abre o documento. Eu já tenho o notepad2 baixado.

    
por Ray Fan 09.01.2012 / 15:45

1 resposta

0

Você pode fazer isso adicionando / editando diretamente o Registry Keys .

Digite regedit.exe em Executar.

Por outro lado, abaixo está o código NON-TESTED vbscript: -

NOTE: Please be careful, while playing with registry keys.

CÓDIGO:

Set WshShell = CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
Dim MyKey, EditorName, KeyToAdd, rtn, MyKeySelf
MyKey = Inputbox("Type the application name with full path", "Add a HTML Editor", "C:\Windows\Notepad.exe")

if trim(MyKey) = "" then WScript.Quit

MyKeySelf = """" + MyKey + """" & " " & """" + "%1" + """"

if not fs.fileexists(MyKey) then
    rtn = msgbox("Specified file is missing, do you want to continue anyway?", 36, "Add a HTML Editor")
        if rtn = 6 then
            Call AddEditor
        else
            WScript.Quit
        end if
else
    Call AddEditor
end if

Sub AddEditor()
    EditorName = fs.GetFileName(MyKey)
    KeyToAdd = "HKCR\.htm\openwithlist\" & EditorName & "\"
    WshShell.RegWrite KeyToAdd,"","REG_SZ"
    KeyToAdd = "HKCR\Applications\" & EditorName & "\shell\edit\command\"
    WshShell.RegWrite KeyToAdd,MyKeySelf,"REG_SZ"

    rtn = msgbox("Added... Do you want to set it as the default HTML Editor?", 36, "Add a HTML Editor")
    if rtn = 6 then
        Call SetAsDefaultEditor
    end if  
end sub

Sub SetAsDefaultEditor()
    On Error resume next
    KeyToAdd = "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command\"
    WshShell.RegWrite KeyToAdd,MyKeySelf,"REG_SZ"
    KeyToAdd = "HKCU\Software\Microsoft\Shared\HTML\Default Editor\shell\edit\command\"
    WshShell.RegWrite KeyToAdd,MyKeySelf,"REG_SZ"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\Description"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\ddeexec\Topic\"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\ddeexec\Application\"
    WshShell.Regdelete "HKCU\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\ddeexec\"
end sub

Set WshShell = Nothing
Set fs = Nothing
    
por 09.01.2012 / 17:58