我存储从TextEdit文本在一个AppleScript变量,我想将它传递给JavaScript。 我想我这样做是正确的,但我始终无法存储的值。 代码如下:
tell application "TextEdit"
activate
set docText to the text of the front document --This works. I've checked.
end tell
tell application "Google Chrome"
tell window 1
tell active tab
execute javascript "function encryptDocument() {
plainText = '" & docText & "';
return plainText;
} encryptDocument();"
set skurp to the result
display dialog skurp
end tell
end tell
end tell
我一个房子内的JavaScript代码的原因tell application "Google Chrome"
命令是因为我得到每次我试图调用它前一次错误tell application "TextEdit"
命令。 错误总是说,它预计线的一端,但发现"
。不知道为什么,但我不能找到解决这个问题的方法。