2011-09-01 106 views
0

我想获取Safari 5.1(Mac OS X)网页的内容并使用Applescript将其粘贴到其他应用程序中。在Applescript中获取Safari窗口的内容

我相对aufa fait与AppleScript,但没有与JavaScript,假设答案在于JavaScript。

我可以使用系统事件,使用击键以全选,然后复制...这工作正常,但我有两个问题与此:

  1. 它的丑陋,当然必须有办法编程做这个。
  2. 我无法撤消我所做的全部选择,哪个更丑?

任何人都可以帮忙吗?

谢谢,Nic。

回答

1

你可以试试这个...

set the webpage_content to "" 
tell application "Safari" to set the webpage_content to the text of document 1 
tell application "TextEdit" 
    activate 
    set the text of the front document to the webpage_content 
end tell