【HSP3】さまざまな検索エンジンに対応したIEコンポーネント自動代入&送信スクリプトサンプル

getElementsByTagNameを使用。

1. getElementsByTagNameでinputタグの要素ノードを検索
2. もしそれがtextだった場合はキーワードを代入
3. inputタグのformタグの要素ノードを取得
4. submitで送信

getElementsByTagNameを使用。

1. getElementsByTagNameでinputタグの要素ノードを検索
2. もしそれがtextだった場合はキーワードを代入
3. inputタグのformタグの要素ノードを取得
4. submitで送信

	keyword = "HSP"
	
	sites.0 = "http://www.google.co.jp/", "http://www.yahoo.co.jp/", "http://www.goo.ne.jp/"
	sites.3 = "http://www.excite.co.jp/", "http://jp.msn.com/", "http://www.infoseek.co.jp/"
	sites.6 = "http://www.livedoor.com/", "http://www.baidu.jp/", "http://www.naver.jp/"
	
	// 乱数
	randomize
	site = sites(rnd(length(sites)))
	
	newcom ie, "InternetExplorer.Application"
	ie("Visible")=1
	ie->"Navigate" site
	mes site
	repeat
		wait 10  :  if( ie("Busy") == 0 ) {  break  }
	loop
	o = ie("Document")
	repeat
		wait 10  :  if( o("readyState") == "complete" ) {  break  }
	loop
	
	pDoc = ie("Document")
	comres pInputs
	// inputを検索
	pDoc->"getElementsByTagName" "input"
	num = pInputs("length")
	repeat num
		pInput = pInputs("item", cnt)
		// typeを取得する
		comres type
		pInput->"getAttribute" "type"
		// type = text の時
		if type == "text" {
			// キーワードをセットする
			pInput("value") = keyword
			// formを参照
			pFrom = pInput("form")
			// 送信
			pFrom->"submit"
			break
		}
	loop
	delcom pFrom
	delcom pInput
	delcom pInputs
	delcom pDoc
	delcom ie
end