Search_amazon
スクリプト例:
/*amazon.co.jpで商品を検索*/
レイアウト切り替え [「amazon」 (amazon)]
#amazon.co.jp を開く
変数を設定 [$er; 値:ie_Navigate_Create ( "http://www.amazon.co.jp/" ;"true")]
#読み込み完了を待つ
変数を設定 [$er; 値:ie_Wait4ie]
#Internet Explorer を再最前面へ(ScriptMakerMSの関数)
変数を設定 [$er; 値:iiil_WindowActivate( "Internet Explorer" ; 0 ; 0 ; 0 ; 0 ; "SWP_NOMOVE|SWP_NOSIZE" )/*TOPMOST|SWP_NOMOVE|SWP_NOSIZ
#JavaScript(JScript)の変数「Target」に"ie.document"を代入
変数を設定 [$er; 値:ie_SetTarget ( "ie.document")]
#検索カテゴリーを設定
変数を設定 [$er; 値:ie_SetInputValueById("searchDropdownBox";amazon::gCategory)]
#検索値を設定
変数を設定 [$er; 値:ie_SetInputValueById ( "twotabsearchtextbox" ; amazon::g検索 )]
#検索(GO)ボタンをクリック
変数を設定 [$er; 値:ie_ClickByTagName ( "input" ; 2 )]
変数を設定 [$er; 値:ie_Wait4ie]
変数を設定 [$n; 値:0]
Loop
カスタムダイアログを表示 ["!"; "1ページ分の情報を取得しますか?"]
If [Get ( 最終メッセージ選択 ) = 1]
Else
Exit Loop If [1]
End If
Loop
変数を設定 [$id; 値:"result_" & $n]
#操作対象の要素をターゲットにする「<DIV id=result_0 ...>.....</DIV>」
変数を設定 [$er; 値:ie_SetTarget ( "ie.document.getElementById('" & $id & "')")]
変数を設定 [$er; 値:ie_GetByTagName("div";0;"className")]
Exit Loop If [IsEmpty ( $er )]
新規レコード/検索条件
ウインドウ内容の再表示 []
#商品名を取得
フィールド設定 [amazon::title; ie_GetByTagName ( "h3" ; 0 ; "innerText" )]
#商品ページへのリンクアドレスを取得
フィールド設定 [amazon::link; ie_GetByTagName ( "a" ; 0 ; "href" )]
#価格を取得
フィールド設定 [amazon::価格; ie_GetByClassName ( "price" ; 0 ; "innerText" )]
#画像のアドレス(SRCの値)を取得
フィールド設定 [amazon::imgSRC; ie_GetByClassName ( "productImage" ; 0 ; "src" )]
#画像をオブジェクトフィールドへ取得
フィールド設定 [amazon::imgObj; iiil_GetDataToField( amazon::imgSRC )]
フィールドへ移動 []
変数を設定 [$n; 値:$n+1]
End Loop
ウインドウ内容の再表示 []
フィールド設定 [SYSTEM::er; ie_SetTarget ( "ie.document")]
変数を設定 [$er; 値:ie_ClickLinkByInnerText ( "次へ" )]
スクリプト一時停止/続行 [間隔(秒): 1]
Exit Loop If [IsEmpty ( $er )]
変数を設定 [$er; 値:ie_Wait4ie]
End Loop