どうぞ
// 画面上からいろいろな情報をアレするコード // IEを自動制御するUWSCコードの参考 // http://d.hatena.ne.jp/language_and_engineering/20140204/controlIeBrowserbyUWSC // アクセスしたいページのURL url = "http://ex-option.com/jp/pc/demos/trade" // 新規IEオブジェクトを作成 ie = createOLEobj("InternetExplorer.Application") // 起動中のIEを見えるように ie.visible = True wid = hndtoid( ie.hwnd ) acw( wid ) // 対象ページを開く ie.navigate( url ) ie_wait( ie ) sleep(3) // 現在のレート span_rate = tag_and_class_from( ie.Document, "span", "dsn_now_rate now" ) msgbox( "現在のレートは" + span_rate.innerHTML ) // minボタン sleep(2) label1 = gid( ie, "label1" ) label1.click() msgbox("min1をクリックしました。") sleep(2) label2 = gid( ie, "label2" ) label2.click() msgbox("min2をクリックしました。") // High/Low td_high = tag_and_class_from( ie.Document, "td", "dsn_high_button" ) as_high = tag_name_from( td_high, "a" ) a_high = as_high.Item(0) a_high.onclick() msgbox("HIGHをクリックしました。") td_low = tag_and_class_from( ie.Document, "td", "dsn_low_button" ) as_low = tag_name_from( td_low, "a" ) a_low = as_low.Item(0) a_low.onclick() msgbox("LOWをクリックしました。") // 金額ボタンは押さずに数値を直接入力する price_box = gid( ie, "money" ) price_box.value = "1000" sleep(3) price_box.value = "5000" sleep(3) // 購入 buy_button = gid( ie, "buy_button" ) buy_button.onclick() msgbox("完了") // 以下は関数 // IEがビジー状態の間待ちます procedure ie_wait( ie ) repeat sleep( 0.1 ) until ( ! ie.busy ) and ( ie.readystate = 4 ) sleep( 0.2 ) fend // getElementById function gid( ie, dom_id ) result = ie.document.getElementById( dom_id ) fend // getElementsByTagName( parent, tag_name ) function tag_name( ie, tag_name ) result = tag_name_from( ie.Document, tag_name ) fend function tag_name_from( parent, tag_name ) result = parent.getElementsByTagName( tag_name ) fend // タグ名とクラス名を指定して最初の1つだけ要素を返す function tag_and_class_from( parent, tag_name, class_name ) tags = tag_name_from( parent, tag_name ) for i = 0 to tags.length - 1 ifb tags.Item( i ).getAttribute("class") = class_name then result = tags.Item( i ) endif next fend