Created
May 27, 2017 01:15
-
-
Save swatari/98ae945ea3eaa1d9224f3642907408b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERSION BUILD=9030808 RECORDER=FX | |
'PROMPT "Please enter text" !VAR1 | |
SET !VAR1 証券 | |
'SET !VAR1 ゴールドマン | |
'SET !VAR1 サックス | |
'SET !VAR1 レギュラー | |
'SET !VAR1 インターナショナル | |
'SET !VAR1 パリバ | |
' | |
'SET !ERRORIGNORE NO | |
'SET !EXTRACT_TEST_POPUP YES | |
SET !ERRORIGNORE YES | |
SET !EXTRACT_TEST_POPUP NO | |
' | |
SET !DATASOURCE data_j.csv | |
SET !LOOP 1 | |
SET !DATASOURCE_LINE {{!LOOP}} | |
URL GOTO=https://s.sbisec.co.jp/smweb/price/stockQuarter.do?ipm_product_code={{!COL2}}&market=TKY | |
' Extract all the text on the page | |
TAG POS=1 TYPE=HTML ATTR=* EXTRACT=TXT | |
' Use EVAL with a regular expression to count the number of occurrences of the target word | |
SET !VAR2 0 | |
SET !VAR2 EVAL("var pageText = \"{{!EXTRACT}}\"; var matches = pageText.match(/{{!VAR1}}/gi); matches.length;") | |
SET !EXTRACT NULL | |
ADD !EXTRACT {{!COL2}} | |
ADD !EXTRACT {{!COL3}} | |
ADD !EXTRACT {{!COL4}} | |
ADD !EXTRACT {{!VAR2}} | |
SAVEAS TYPE=EXTRACT FOLDER=* FILE=data_j.out.csv | |
' PROMPT "Finished!!"&!VAR1 | |
' PROMPT "See c:\Users\shingo\Documents\iMacros\Downloads\" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment