ブラウザからテキストを取得するスクリプト。
ほしい情報をまとめてダウンロードするときに使っています。
目的のURLは末尾が /YYYYMMDD となることが多いので、
日付の計算をして、○○○○年○○月○○日から××××年××月××日までのデータを取るときがあります。
サブルーチンが使えれば楽ですね。
- –SafariからURLとテキストをJeditにペースト
- –先にJedit書類を開いておく
- tell application “Safari“
- try
- tell document 1
- set theURL to URL
- set theText to every text
- set theTarget to theURL & return & theText & return
- set the clipboard to theTarget
- end tell
- on error
- set theText to null
- end try
- end tell
- if (theText ≠ null) then
- tell application “Jedit X“
- tell front document
- activate
- do menu item “ペースト“
- end tell
- end tell
- end if
- (*
- andと&で動く時と動かないときがある。
- andは論理式で使った方がいいかも。
- clipbordが記憶できるのは一個だけということを忘れていた。
- *)
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー