nick wrote:
Code:
; ...
NewStr := RegExReplace(Sub1, "\(.*?\)", "", count) ; removes the parenethis in a name.
; ...
L%A_Index%Results := RegexReplace(RegExReplace(Sub1, "\D"), "^$", "0")
; ...
n%A_Index%Results := RegexReplace(RegExReplace(Subl1, "\D"), "^$", "0")
; ...
m%A_Index%Results := RegexReplace(RegExReplace(Subl1, "\D"), "^$", "0")
; ...
Ha it worked! Good to see you again Nick! Thank you everyone for your suggestions!
Code:
f8::
S := 1
L0 := 0
URLDownloadToFile,http://en.wikipedia.org/w/index.php?title=Category:Unreferenced_BLPs_from_April_2007&from=Li+Na, wiki.txt
; shorter list Category:Chinese_centenarians
FileRead, Con, wiki.txt
While (Pos := RegExMatch(Con, "<li><a href=""/wiki/.*?"" title=""(\S.+?)"">", Sub, S)) {
; original script: <ul><li><a href="/wiki/Hiroshi_Takeyasu" title="Hiroshi Takeyasu">Hiroshi Takeyasu</a></li></ul>
L0++
Q := Sub1
S := Pos + StrLen(Sub1) + 13
NewStr := RegExReplace(Q, "\(.*?\)", " ", count) ; removes the parenthesis in a name.
; msgbox %NewStr% for testing
URLDownloadToFile, http://news.google.com/archivesearch?q="%NewStr%"+&btnG=Search+Archives, google.txt
FileRead, CCon, google.txt
RegExMatch(CCon, "of (?:about )?<b>(\S+)</b>", Sub)
L%A_Index%Results := RegexReplace(RegExReplace(Sub1, "\D"), "^$", "0")
;msgbox, %Q% "http://books.google.com/books?q=+"%NewStr%"+&btnG=Search+Books" ; for testing
URLDownloadToFile, http://books.google.com/books?q=+"%Q%"+&btnG=Search+Books, google.htm
FileRead, CCon1, google.htm
RegExMatch(CCon1, "of (?:about )?<b>(\S+)</b>", Subl)
n%A_Index%Results := RegexReplace(RegExReplace(Subl1, "\D"), "^$", "0")
;msgbox, %Q% "http://scholar.google.com/scholar?&q="%NewStr%"""" ; for testing
URLDownloadToFile, http://scholar.google.com/scholar?&q="%Q%, google.htm
FileRead, CCon1, google.htm
RegExMatch(CCon1, "of (?:about )?<b>(\S+)</b>", Subl)
m%A_Index%Results := RegexReplace(RegExReplace(Subl1, "\D"), "^$", "0")
L%A_Index% := NewStr
}
L := "<span class=""plainlinks"">`r`n{|class=""wikitable sortable""`r`n!Name!!Google news!!Google books!!Google scholar"
;L := "Found " . L0 . " results.`r`n"
Loop %L0%
L .= "`r`n|-valign=top `r`n|align=left|[[" . L%A_Index% . "]]`n|align=center|<!--news-->[http://news.google.com/archivesearch?q={{urlencode:""" . L%A_Index% . """}}+&btnG=Search+Archives " . L%A_Index%Results . "]`n|align=center|<!--books-->[http://books.google.com/books?q=+{{urlencode:""" . L%A_Index% . """}}+&btnG=Search+Books " . n%A_Index%Results . "]`n|align=center|<!--scholar--> [http://scholar.google.com/scholar?&q={{urlencode:""" . L%A_Index% . """}} " . m%A_Index%Results . "]"
;MsgBox %L% ; for testing
FileAppend, %L%, %a_scriptdir%\L.txt
Run, %a_scriptdir%\L.txt
Return