IE 拡張メニューインストーラ 【ページ上の画像を使用したHTML作成】

IE で表示されている画像の URL を使用して IMG タグをと属性を再構成します。
設定される他の属性は、 galleryimg と border と style( カラーのみ ) ですが、
それはインストール前にコードを変更すれば自由に設定できます。

※ alt と title に関しては、オリジナルを引き継いで埋め込みます。
※ インストール後に、レジストリを直接変更してもベースの HTML は変更できます
この画像を使用したHTML 以外のコマンドは別のインストーラでインストールしたものです



ブラウザでダウンロード( winofsql.jp を信頼していただけるなら、そのまま実行して使えます )


このリンクはアンインストーラです



作成されるHTML
属性は固定ですが、インストーラのベースコードを変更すれば変わります。
( 再インストールすれば OK です )

※ alt や title があれば、引継ぎます

※ 以下のコードは見易さの為に改行を入れています( 実際は一行 )
※ しかし、これもソースコードで変更可能です
<img
 src="http://winofsql.jp/image/winofsql.png" 
 galleryimg="no"
 border="1"
 style='border-color:#000000'   />

インストールソースコード
******** ●ここを変更● ******** の部分を変更すると、
オリジナルが作成できます
<JOB>
<COMMENT>
************************************************************
IE 拡張メニューインストーラ

■ページ上の画像を使用したHTML作成

■著作権その他

このプログラムはフリーです。どうぞ自由に御使用ください。
著作権は作者である私(lightbox)が保有しています。
また、本ソフトを運用した結果については、作者は一切責任を
負えせんのでご了承ください。
************************************************************
</COMMENT>

<SCRIPT
	language="VBScript"
	src="http://homepage2.nifty.com/lightbox/laylaClass.vbs">
</SCRIPT>

<SCRIPT language=VBScript>
' ***********************************************************
' 処理開始
' ***********************************************************
Call laylaFunctionTarget( "http://homepage2.nifty.com/lightbox/" )
Call laylaLoadFunction( "baseFunction.vbs" )

' Csript.exe で実行を強制
Crun

print "【ページ上の画像を使用したHTML作成】をインストールします"
if not OkCancel( "インストールしてもよろしいですか?" ) then
	Wscript.Quit
end if

' ファイルシステムオブジェクト作成
GetFso

strInstallPath1 = ProgDir() & "\laylaClass"
strInstallPath2 = ProgDir() & "\laylaClass\menuex"
' ******** ●ここを変更● ********
strInstallPath3 = ProgDir() & "\laylaClass\menuex\menuex_image_html.vbs"

on error resume next
Call Fso.CreateFolder( strInstallPath1 )
Call Fso.CreateFolder( strInstallPath2 )
on error goto 0

' ******** ●ここを変更● ********
RegName = "−◎この画像を使用したHTML"
Call PutTextFile( strInstallPath3, _
Replace(GetInline("menuex_image_html"),"$REGNAME", RegName ) )

' レジストリ処理用オブジェクト作成
GetWshShell

on error resume next
WshShell.RegWrite _
	"HKCU\Software\Microsoft\Internet Explorer\MenuExt\"&RegName&"\", _
	strInstallPath3, _
	"REG_SZ"
WshShell.RegWrite _
	"HKCU\Software\Microsoft\Internet Explorer\MenuExt\"&RegName&"\Contexts", _
	&H2, _
	"REG_DWORD"
WshShell.RegWrite _
	"HKCU\Software\Microsoft\Internet Explorer\MenuExt\"&RegName&"\Html", _
	"<img src=""$URL"" galleryimg=""no"" border=""1"" style='border-color:#000000' $ALT $TITLE />", _
	"REG_SZ"
on error goto 0

print "処理が終了しました"
print ""

Wscript.Quit

</SCRIPT>

<COMMENT>
******** ●ここを変更● ********
</COMMENT>
<RESOURCE id="menuex_image_html">
<![CDATA[
<meta http-equiv="content-type" content="text/html; charset=SHIFT_JIS">
<SCRIPT language="VBScript">

	Dim obj,str,strText,WshShell,txt

	' レジストリ用
	Set WshShell = CreateObject("WScript.Shell")

	on error resume next
	' *************************************************
	' カーソル下のオブジェクト
	' *************************************************
	Set obj = external.menuArguments.event.srcElement

	' *************************************************
	' 画像専用処理( レジストリ 0x2 )
	' *************************************************
	str = external.menuArguments.event.srcElement.src
	if Err.Number <> 0 then
		str = "URL を取得できませんでした"
	else
		strText = "HKCU\Software\Microsoft\Internet Explorer"
		strText = strText & "\MenuExt\$REGNAME\Html"
		strText = WshShell.RegRead(strText)

		strText = Replace(strText, "$URL", str )

		txt = obj.alt
		if txt <> "" then
			if instr( txt, """" ) = 0 then
				strText = Replace(strText, "$ALT", "alt="""&txt&"""" )
			else
				strText = Replace(strText, "$ALT", "alt='"&txt&"'" )
			end if
		else
			strText = Replace(strText, "$ALT", txt )
		end if

		txt = obj.title
		if txt <> "" then
			if instr( txt, """" ) = 0 then
				strText = Replace(strText, "$TITLE", "title="""&txt&"""" )
			else
				strText = Replace(strText, "$TITLE", "title='"&txt&"'" )
			end if
		else
			strText = Replace(strText, "$TITLE", txt )
		end if

		' 取得できたらクリップボードにセット
		Call window.clipboardData.setData("Text",strText)

		str = strText
	end if
	on error goto 0

	alert(str)

</SCRIPT>
]]>
</RESOURCE>

</JOB>