2022年5月
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
無料ブログはココログ

« 2011年7月 | トップページ | 2011年9月 »

2011年8月30日 (火)

バッチファイルで作るteeコマンド(その2)

unixのteeコマンド擬似をバッチファイル機能だけで作ります。
ただし、コンカレントな出力でないので、インタラクティブ処理には使えません。
また、teeコマンドの分岐先はファイル出力ですが、標準エラー出力のほうが、汎用的です。

tee.cmd

@echo off
more > %temp%\teeclip.tmp
type %temp%\teeclip.tmp >&2
type %temp%\teeclip.tmp

また、クリップボードに分岐するには、

~ | tee.cmd | clip.exe

あるいは、

teeclip.cmd

@echo off
more > %temp%\teeclip.tmp
type %temp%\teeclip.tmp | clip.exe
type %temp%\teeclip.tmp

標準出力だけでなく、標準エラーも回送するなら、

~ 2>&1 | teeclip

2011年8月26日 (金)

IE9でタブブラウズを無効にすると、タイトルがどこにも表示されない。

これもきっと仕様(By Design)なんでしょう。

あんまりなので、代わりにステータスバーに表示します。

IE Titler.hta

<head><title>IE Titler</title>
<script language=vbscript>
resizeTo 210,10
Set ies=CreateObject("Shell.Application").Windows()
setInterval "proc1",1000
Sub proc1
    On Error Resume Next
    Call proc2
End Sub
Sub proc2
For Each ie In ies
  If InStr(LCase(ie.FullName),"iexplore.exe") Then
    ie.StatusText=ie.Document.title
  End If
Next
End Sub
</script>
</head>

2011年8月14日 (日)

「Web アーカイブ、単一のファイル (*.mht)」で「名前を付けて保存」する。(その3)

IE9で「名前を付けて保存」のデフォルトが「Web ページ、完全 (*.htm;*.html)」に変わりました。

デスクトップフォルダなどで作成し、お気に入りバーフォルダに移動で入れます。ieのお気に入りバーから起動します。

Web アーカイブ、単一のファイル (.mht).vbs

Set ies=CreateObject("Shell.Application").Windows()
For Each ie In ies
  If ie.ReadyState=4 Then If TypeName(ie.Document)="HTMLDocument" Then If ie.Document.hasFocus() Then Exit For
Next
If IsEmpty(ie) Then
  For Each ie In ies
    If ie.ReadyState<>4 Then
    ElseIf TypeName(ie.Document)="HTMLDocument" Then
      ie.Document.focus
      If ie.Document.hasFocus() Then Exit For
    End If
  Next
End If
If IsEmpty(ie) Then
  MsgBox "Not Found"
  WScript.Quit
End If
href=ie.Document.parentWindow.location.href
Set a=ie.Document.createElement("a")
a.href=href
a.hash="##"
ie.Document.parentWindow.setTimeout "location.replace """ & a.href & """",0,"vbscript"
Do While ie.Document.parentWindow.location.hash<>"##"
  WScript.Sleep 100
Loop
ie.ExecWB 4,1
ie.Document.parentWindow.location.replace href

ページがキャッシュされてないと、デフォルトがアーカイブ形式に変わります。

2011年8月13日 (土)

IE9の「名前を付けて保存」のデフォルト形式はキャッシュの有無で変わる。

IE9の「名前を付けて保存」のデフォルト形式は「完全」に変わりました。仕様だそうです。

ただし、これはキャッシュの有無で変わります。キャッシュにないと、「アーカイブ」になります。仕様かバグかは不明です。

ただし、キャッシュにないと、デフォルトファイル名のベース名末尾にurlのファイル拡張子の残骸の文字列が付きます。これは障害でしょう。

2011年8月 5日 (金)

リンクを右クリックして「新しい最大化ウィンドウで開く」 IEのコンテキストメニュー拡張

最大化と言っても擬似最大化(最大化の位置とサイズ)です。

C:\どこか\OpenNewMaxWindow.htm

<script language=vbscript defer>
If UCase(external.menuArguments.event.srcElement.tagName)="A" Then
  Set win=open(external.menuArguments.event.srcElement.href)
ElseIf UCase(external.menuArguments.event.srcElement.parentElement.tagName)="A" Then
  Set win=open(external.menuArguments.event.srcElement.parentElement.href)
End If
win.moveTo 0,0
win.resizeTo screen.availWidth,screen.availHeight
</script>

OpenNewMaxWindow.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\新しい最大化ウィンドウで開く]
@="C:\\どこか\\OpenNewMaxWindow.htm"
"Contexts"=dword:00000022

2011年8月 2日 (火)

Vistaで、IEのキャッシュフォルダ(Temporary Internet Files)で「保護モード:有効」のコンテンツを見る。(その2)

explorer.exeを「整合性レベル:低」で起動すれば、ちゃんと見えます。

バッチファイルで、

lowcache.cmd

(
echo;explorer.exe /separate,shell:cache
echo;del "%temp%\Low\lowcache.cmd"
) >"%temp%\Low\lowcache.cmd"
start iexplore "%temp%\Low\lowcache.cmd"

このとき、IEの「ファイルのダウンロード - セキュリティの警告」ダイアログや「ダウンロードの表示」ダイアログが出ます。「実行」を選択します。

このexplorer.exeは「整合性レベル:低」なのでキャッシュを見終わったら閉じましょう。このexplorer.exeの実行中はバッチファイルのコンソールが開いたままexplorer.exeの終了を待っています。
もし、分からなくなったらタスクマネジャでコマンドラインを見ると分かります。また、新規作成にフォルダしかなくそれに盾マークが付いています。

2011年8月 1日 (月)

IE9でabout:homeが復活した。

IE8の頃は、about:homeが使えなくなっていたが、IE9現在、直りました。
ただし、ファイル名の長さに制限があるようです。
8文字のようで、
~~~/home.htm
にしたら、通りました。

« 2011年7月 | トップページ | 2011年9月 »