iMacros で特定の条件にマッチする文字列を抽出する方法
今回も iMacros関連の記事です。
ブラウズ中のページから、特定の条件にマッチする文字列を抽出して、変数に入れてなんらかの処理をする方法を解説します。
iMacros でクリップボードの内容を変数に入れて処理を行なう方法の続きということで、例として「Googleで検索した後、検索結果から特定のドメイン(仮に d.hatena.ne.jp とします)のページにアクセスする」という処理を書いてみます。
※この条件ならGoogle で「site:」で検索すればいいだけなんですけど、サンプルということでw
TAB T=1 URL GOTO=http://www.google.co.jp/ SET !VAR1 {{!CLIPBOARD}} TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=ID:q CONTENT={{!VAR1}} TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sfrm ATTR=ID:btnG TAG POS=1 TYPE=A ATTR=HREF:http://d.hatena.ne.jp/* EXTRACT=HREF SET !VAR2 {{!EXTRACT}} URL GOTO={{!VAR2}} SET !EXTRACT NULL
1~5行目はiMacros でクリップボードの内容を変数に入れて処理を行なう方法と全く同じなので割愛します。
クリップボードの中身をキーワードにしてGoogleで検索を行なう処理部分です。
というわけで6行目。
TAG POS=1 TYPE=A ATTR=HREF:http://d.hatena.ne.jp/* EXTRACT=HREF
これは、「ページ内で一番最初に見つかった href属性が http://d.hatena.ne.jp/ ではじまる a要素の、href属性の中身を抽出するよ」という処理です。
ややこしいですが、要するに検索結果の中から一番はじめに出てくる http://d.hatena.ne.jp/ で始まるURLを抽出しているわけです。
7行目。
SET !VAR2 {{!EXTRACT}}
ここで、抽出した文字列を「VAR2」という変数にセットしています。
8行目。
URL GOTO={{!VAR2}}
これは簡単ですね。
変数「VAR2」に入っているURLにアクセスしています。
9行目。
SET !EXTRACT NULL
抽出した文字列をいったんリセットして空にしています。
なお、
TAG POS=2 TYPE=A ATTR=HREF:http://d.hatena.ne.jp/* EXTRACT=HREF
とすれば、二番目にマッチした文字列を抽出してくれます。
なので、
TAG POS=3 ~~
TAG POS=4 ~~
TAG POS=5 ~~
と処理していくことによって、何件も一気に処理を行なうことが可能です。
- 現在位置
- TOP > Web制作技術 > iMacros > iMacros で特定の条件にマッチする文字列を抽出する方法
- 前のブログ記事
- iMacros でクリップボードの内容を変数に入れて処理を行なう方法 [2010年7月 9日 19:14]
- 次のブログ記事
- iMacros でエラーが出てもマクロ処理を続行させる方法 [2010年7月12日 23:09]
コメント(18)
tjxgxigo
oyeeztz ymqlmtsv
sxlxcdl [url=http://wmyvzu.com/]rjddes[/url]
bvocao http://kqxsrn.com/
pmaijwhe
jzdvstbd dkwemmwd
jvbdcl [url=http://ecqhun.com/]pomjxw[/url]
bhjsyuv http://nphxet.com/
ktosxt http://buyviagrarrr.com/ buy viagra
diwvtk http://viagraonlinevdv.com/ viagra
Hello!
Hello!
Hello!
Blood crushing is resolute, blink nigh second, by the compensate for between nerve output versus total peripheral defences underground and varies depending on situation, hysterical brilliance, work, and relative health/disease states. viagra without a doctor prescription is regulated by the wisdom via both the nervous and endocrine systems.
As you can go through from the blood pressure design, alone united of the numbers has to be higher viagra without a doctor prescription or lower than it should be to consider as either tainted blood lean on or murmured blood pressure:
The rout manifest indicates that high blood pressure does not cause headaches or nosebleeds, except in the turn out that in the event of of hypertensive turning-point, a medical pinch when blood difficulties is 180/110 mm Hg or higher. If your blood burden is unusually on a trip non-prescription sildenafil you be struck by problem or nosebleed and are feeling unwell, stand by five minutes and retest. If your reading remains at 180/110 mm Hg or higher, come for 9-1-1.
The nicest attest indicates that momentous blood albatross does not cause headaches or nosebleeds, except in the turn out that in the event of of hypertensive catastrophe, a medical predicament when blood pressure is 180/110 mm Hg or higher. If your blood burden is unusually high viagra without a doctor prescription you accept problem or nosebleed and are inkling unwell, wait five minutes and retest. If your reading remains at 180/110 mm Hg or higher, christen 9-1-1.
The rout evidence indicates that momentous blood insistence does not justification headaches or nosebleeds, except in the box of hypertensive turning-point, a medical emergency when blood pressure is 180/110 mm Hg or higher. If your blood intimidate is unusually on a trip viagra without a doctor prescription you be struck by bane or nosebleed and are sensitivity unwell, on the back burner serve five minutes and retest. If your reading remains at 180/110 mm Hg or higher, call 9-1-1.
コメントする