重ねて質問すみません。
教えていただいたテキスト取り出しはわからなかったのですが、
ブラウザのクラスを指定して情報を取り出す、という方法がありました。
to getInputByClass(theClass, num) -- defines a function with two inputs, theClass and num
tell application "Safari" --tells AS that we are going to use Safari
set input to do JavaScript "
document.getElementsByClassName('" & theClass & "')[" & num & "].innerHTML;" indocument 1 -- uses JavaScript to set the variable input to the information we want
end tell
return input--tells the function to return the value of the variable input
end getInputByClass
http://www.cubemg.com/how-to-extract-information-from-a-website-using-applescript/
三省堂のページだと、和訳部分のクラスがdiv class="NetDicBody"らしいです。
教えていただいたスクリプトを
この方法に改変する方法を教えたいただけないでしょうか?
何卒よろしくお願いいたします。
tell front document of application "Numbers"
tell active sheet
set theTable to first table whose class of selection range is range
tell theTable
set wordList to value of cells of selection range
end tell
end tell
end tell
property wordList : {"preacher", "wisdom", "Recognition"}
property definitionList : {}
property workflowPath : "~/Desktop/GetTextFromWebPage.workflow"
repeat with theWord in wordList
set theURL to "http://www.sanseido.biz/User/Dic/Index.aspx?TWords=" & theWord & "&st=0&DORDER=&DailyEJ=checkbox"
set theScript to "automator -i \"" & theURL & "\" " & workflowPath
set str to (do shell scripttheScript)
set definitionList to definitionList & str
end repeat
definitionList