IE.documentから取得できる情報
ページにアクセスすると、そのページ内の情報(IE.document)が取得できます
■ドキュメント
- タイトル
- IE.document.title
- ドキュメントタイプ
- IE.document.doctype
- 背景色
- IE.document.bgColor
- 文字色
- IE.document.fgColor
- 文字コード
- IE.document.charSet
- ブラウザのデフォルト文字コード
- IE.document.defaultCharset
- リンク中の文字色
- IE.document.alinkColor
- リンク文字色
- IE.document.linkColor
- リンク済の文字色
- IE.document.vlinkColor
- アンカーの数
- IE.document.anchors.length
- アンカー名(0からの数字を指定)
- IE.document.anchors[n].name
- クッキー
- IE.document.cookie
- ドメイン名
- IE.document.domain
- 現在のページのURL
- IE.document.URL
- 指定座標上のオブジェクト情報
- IE.document.elementFromPoint(X,Y)
- リファラ
- IE.document.referrer
というわけで、ひとつひとつ解説するよりは
具体的にスクリプトを実行させて、結果を見てみましょう。
IE = CREATEOLEOBJ("InternetExplorer.Application") IE.visible = True IE.navigate("http://canal22.org/sample0001") REPEAT SLEEP(0.1) UNTIL !IE.busy AND IE.readyState = 4 PRINT "■ドキュメント" PRINT " タイトル" PRINT " IE.document.title=" + IE.document.title PRINT " ドキュメントタイプ" PRINT " IE.document.doctype=" + IE.document.doctype PRINT "■ベース色" PRINT " 背景色" PRINT " IE.document.bgColor=" + IE.document.bgColor PRINT " 文字色" PRINT " IE.document.fgColor=" + IE.document.fgColor PRINT "■文字コード" PRINT " 文字コード" PRINT " IE.document.charSet=" + IE.document.charSet PRINT " ブラウザのデフォルト文字コード" PRINT " IE.document.defaultCharset=" + IE.document.defaultCharset PRINT "■リンク文字色" PRINT " リンク中の文字色" PRINT " IE.document.alinkColor=" + IE.document.alinkColor PRINT " リンク文字色" PRINT " IE.document.linkColor=" + IE.document.linkColor PRINT " リンク済の文字色" PRINT " IE.document.vlinkColor=" + IE.document.linkColor PRINT "■アンカーオブジェクト" PRINT " アンカーの数" PRINT " IE.document.anchors.length=" + IE.document.anchors.length FOR A = 0 TO (IE.document.anchors.length - 1) PRINT " アンカー名(" + A + ")" PRINT " IE.document.anchors[" + A + "].name=" + IE.document.anchors[A].name NEXT PRINT "■クッキー" PRINT " クッキー" PRINT " IE.document.cookie=" + IE.document.cookie PRINT "■ドメイン" PRINT " ドメイン名" PRINT " IE.document.domain=" + IE.document.domain PRINT " 現在のページのURL" PRINT " IE.document.URL=" + IE.document.URL PRINT " 指定座標上のオブジェクト情報(ここではx=100,y=100を指定)" PRINT " IE.document.elementFromPoint(100,100)=" + IE.document.elementFromPoint(100,100) //リファラを表示するためにリンクをクリック IE.document.links[0].click() REPEAT SLEEP(0.1) UNTIL !IE.busy AND IE.readyState = 4 PRINT "■リファラ" PRINT " リファラ" PRINT " IE.document.referrer=" + IE.document.referrer IE.navigate("http://canal22.org/sample0001") REPEAT SLEEP(0.1) UNTIL !IE.busy AND IE.readyState = 4
どうでしょうか。
IE.documentにある種々の情報が取得できましたか。
それでは、応用編というわけではありませんが、
上記のスクリプトをExcelに出力するというスクリプトにしてみましょう。
ExcelとIEの簡単な連携ですね。それではスクリプトです。
タグ
alinkColor、anchors.length、anchors.name、bgColor、charSet、COM、cookie、defaultCharset、doctype、document、domain、elementFromPoint、fgColor、IE、InternetExplorer、linkColor、referrer、title、URL、vlinkColor
2012年7月3日 | コメントは受け付けていません。 |
カテゴリー:UWSCとInternetExplorer