IE11のソースエディタの変更 / VBScript

最新の IE11 では、HKEY_CURRENT_USER でしか動作しないようです。





全て VBScript のみで実行しています。ですから、ファイル参照ウインドウの表示が、現在表示しているウインドウに隠れたりする場合があるので注意して下さい。

ieSrcEditor.wsf をエクスプローラから実行すると、ファイルを参照するダイアログが開きます。内部のコードは以下のようになっていますが、必要な関数等はインターネット上に保存して使用しています。ここでは、ローカルのファイルを開いてパスを取得する為に、InternetExplorer.Application を使用しています。

アンインストールは、zip 内の uninstall.reg か 以下のテキストを uninstall.reg として shift_jis か Unicode で保存してエクスプローラから実行します。内部は、Microsoft の仕様によるレジストリエントリの削除記述となっています。ですから、実際削除を行うのは、regedit.exe です。
1.Windows Registry Editor Version 5.00
2. 
3.[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\View Source Editor]

▼ 実行用のソースコードです
01.<JOB>
02.<COMMENT>
03.************************************************************
04. WEB WSH 実行スケルトン
05.************************************************************
06.</COMMENT>
07. 
08.<COMMENT>
09.************************************************************
10. 外部スクリプト定義
11.************************************************************
12.</COMMENT>
13.<SCRIPT
14.        language="VBScript"
15.        src="http://lightbox.in.coocan.jp/laylaClass.vbs">
16.</SCRIPT>
17. 
18.<SCRIPT language=VBScript>
19.' 管理者として実行を強制する
20.Set obj = Wscript.CreateObject("Shell.Application")
21.if Wscript.Arguments.Count = 0 then
22.        obj.ShellExecute "wscript.exe", WScript.ScriptFullName & " runas", "", "runas", 1
23.        Wscript.Quit
24.end if
25. 
26.' ***********************************************************
27.' 処理開始
28.' ***********************************************************
29.Call laylaFunctionTarget( "http://lightbox.in.coocan.jp/" )
30.Call laylaLoadFunction( "baseFunction.vbs" )
31.Call laylaLoadFunction( "wmiReg.vbs" )
32.Call laylaLoadFunction( "toolFunction.vbs" )
33. 
34.' **********************************************************
35.' エディタ選択
36.' **********************************************************
37.strValue = OpenLocalFileName
38.if strValue = "" then
39.        Wscript.Quit
40.end if
41. 
42.' **********************************************************
43.' レジストリ
44.' **********************************************************
45.strPath = "SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name"
46.Call WMIRegCreateKey( HKEY_CURRENT_USER, strPath )
47.strValue = Dd( strValue )
48.Call WMIRegSetStringValue( HKEY_CURRENT_USER, strPath, Empty, strValue )
49. 
50.MsgOk( strValue & " を IE のソースエディタとして登録しました" )
51. 
52.Function OpenLocalFileName( )
53. 
54.        Call GetObj( "IEDocument", "InternetExplorer.Application" )
55.        IEDocument.Navigate( ScriptDir( ) & "\local.htm" )
56.        IEDocument.document.getElementsByTagName("BODY")(0).innerHTML = "<input id=FilePath type=file>"
57.        IEDocument.document.getElementById("FilePath").click
58.        if IEDocument.document.getElementById("FilePath").value = "" then
59.                OpenLocalFileName = ""
60.                IEDocument.Quit
61.                Set IEDocument = Nothing
62.                Exit Function
63.        end if
64. 
65.        OpenLocalFileName = IEDocument.document.getElementById("FilePath").value
66. 
67.        IEDocument.Quit
68.        Set IEDocument = Nothing
69. 
70.End Function
71.</SCRIPT>
72.</JOB>