【 メソッドと Busy プロパティ 】

1. イベントの代替として Busy プロパティを使用する
2. 印刷プレビュー

  • イベントはあるのですが、VBScript では取得できないようです。その為、最も重要なページがロードされたか
    どうかを Busy プロパティ で検査します

  • <SCRIPT language=VBScript>
     
    Dim Ie
     
    Set Ie = CreateObject("InternetExplorer.Application")
    Ie.Visible = True
    Ie.Navigate("http://hp.vector.co.jp/authors/VA003334/winofsql/document.htm")
     
    Call window.setTimeout("Call TargetWriteLoad()", 100, "VBScript")
     
    function TargetWriteLoad()
     
    	if Ie.Busy then
    		Call window.setTimeout("Call TargetWriteLoad()", 100, "VBScript")
    	else
    		strHTML = Ie.Document.all.tags("HTML")(0).innerHTML
    		Ie.Quit
    		document.write strHTML
    	end if
     
    end function
     
    </SCRIPT>
    


  • ExecWB メソッドを使用します。このメソッドは、その他いろいろな InternetExplorer のコマンドを実行可能
    です
  • <SCRIPT language=VBScript>
     
    Const OLECMDID_PRINTPREVIEW = 7
    Const OLECMDEXECOPT_DODEFAULT = 0
     
    Dim Ie
     
    Set Ie = CreateObject("InternetExplorer.Application")
    Ie.Visible = True
    Ie.Navigate("http://hp.vector.co.jp/authors/VA003334/")
     
    Call window.setTimeout("Call PrintPreview()", 100, "VBScript")
     
    function PrintPreview()
     
    	if Ie.Busy then
    		Call window.setTimeout("Call PrintPreview()", 100, "VBScript")
    	else
    		Call Ie.ExecWB( OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT )
    	end if
     
    end function
     
    </SCRIPT>