こちらから転用させていただきました。ありがとうございます。
- —————————————
- — Title+URI+Text.scpt
- — Version 1.3
- — 2006 Feb 1st
- — Written by NAKAJIMA Hiroki
- —————————————
- — Initialize —
- set thePrevClipboard to the clipboard
- set theText to ““
- set the clipboard to ““
- try
- — Get data from Safari —
- tell application “Safari“
- set theURL to URL of document 1 as Unicode text
- set theTitle to name of document 1 as Unicode text
- set theText to do JavaScript “unescape(escape(getSelection()));“ in document 1
- end tell
- — Set the data to the clipboard
- if (theText is ““) then
- set the clipboard to ((theTitle & return & theURL & return) as Unicode text)
- else
- set the clipboard to ((theTitle & return & theURL & return & return & theText & return) as Unicode text)
- end if
- on error errStr
- set the clipboard to thePrevClipboard
- beep
- log errStr
- end try
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー