最新の IE11 では、HKEY_CURRENT_USER でしか動作しないようです。![]()
全て VBScript のみで実行しています。ですから、ファイル参照ウインドウの表示が、現在表示しているウインドウに隠れたりする場合があるので注意して下さい。 ieSrcEditor.wsf をエクスプローラから実行すると、ファイルを参照するダイアログが開きます。内部のコードは以下のようになっていますが、必要な関数等はインターネット上に保存して使用しています。ここでは、ローカルのファイルを開いてパスを取得する為に、InternetExplorer.Application を使用しています。 アンインストールは、zip 内の uninstall.reg か 以下のテキストを uninstall.reg として shift_jis か Unicode で保存してエクスプローラから実行します。内部は、Microsoft の仕様によるレジストリエントリの削除記述となっています。ですから、実際削除を行うのは、regedit.exe です。
Windows Registry Editor Version 5.00 [-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\View Source Editor]
▼ 実行用のソースコードです
<JOB>
<COMMENT>
************************************************************
WEB WSH 実行スケルトン
************************************************************
</COMMENT>
<COMMENT>
************************************************************
外部スクリプト定義
************************************************************
</COMMENT>
<SCRIPT
language="VBScript"
src="http://lightbox.in.coocan.jp/laylaClass.vbs">
</SCRIPT>
<SCRIPT language=VBScript>
' 管理者として実行を強制する
Set obj = Wscript.CreateObject("Shell.Application")
if Wscript.Arguments.Count = 0 then
obj.ShellExecute "wscript.exe", WScript.ScriptFullName & " runas", "", "runas", 1
Wscript.Quit
end if
' ***********************************************************
' 処理開始
' ***********************************************************
Call laylaFunctionTarget( "http://lightbox.in.coocan.jp/" )
Call laylaLoadFunction( "baseFunction.vbs" )
Call laylaLoadFunction( "wmiReg.vbs" )
Call laylaLoadFunction( "toolFunction.vbs" )
' **********************************************************
' エディタ選択
' **********************************************************
strValue = OpenLocalFileName
if strValue = "" then
Wscript.Quit
end if
' **********************************************************
' レジストリ
' **********************************************************
strPath = "SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name"
Call WMIRegCreateKey( HKEY_CURRENT_USER, strPath )
strValue = Dd( strValue )
Call WMIRegSetStringValue( HKEY_CURRENT_USER, strPath, Empty, strValue )
MsgOk( strValue & " を IE のソースエディタとして登録しました" )
Function OpenLocalFileName( )
Call GetObj( "IEDocument", "InternetExplorer.Application" )
IEDocument.Navigate( ScriptDir( ) & "\local.htm" )
IEDocument.document.getElementsByTagName("BODY")(0).innerHTML = "<input id=FilePath type=file>"
IEDocument.document.getElementById("FilePath").click
if IEDocument.document.getElementById("FilePath").value = "" then
OpenLocalFileName = ""
IEDocument.Quit
Set IEDocument = Nothing
Exit Function
end if
OpenLocalFileName = IEDocument.document.getElementById("FilePath").value
IEDocument.Quit
Set IEDocument = Nothing
End Function
</SCRIPT>
</JOB>

全て VBScript のみで実行しています。ですから、ファイル参照ウインドウの表示が、現在表示しているウインドウに隠れたりする場合があるので注意して下さい。
ieSrcEditor.wsf をエクスプローラから実行すると、ファイルを参照するダイアログが開きます。内部のコードは以下のようになっていますが、必要な関数等はインターネット上に保存して使用しています。ここでは、ローカルのファイルを開いてパスを取得する為に、InternetExplorer.Application を使用しています。
アンインストールは、zip 内の uninstall.reg か 以下のテキストを uninstall.reg として shift_jis か Unicode で保存してエクスプローラから実行します。内部は、