0

我正在遵循以下说明:http : //blog.mackerron.com/2009/05/19/paste-unformatted-keyboard-shortcut-office-2008-mac/ 在 Word 中运行良好。但是当我将下面的代码粘贴到 Applescript 并将其保存到时/Documents/Microsoft User Data/Excel Script Menu Items,我收到了这个错误Syntax Error: Expected end of line, etc. but found “text”.

try
  set theClip to Unicode text of (the clipboard as record)
  tell application "Microsoft Excel" to tell selection to type text text theClip
end try

这里出了什么问题?

4

2 回答 2

1

尝试:

set theClip to the clipboard as text

tell application "Microsoft Excel"
    activate
    set value of active cell to theClip
end tell

或这个:

set theClip to the clipboard as text

tell application "Microsoft Excel" to activate
tell application "System Events" to tell process "Microsoft Excel"
    keystroke theClip
end tell

将脚本拖到此处:

tell application "Finder" to open (path to library folder from user domain as text) & "Application Support:Microsoft:Office:Excel Script Menu Items:"

在此处输入图像描述

于 2012-10-12T13:06:01.820 回答
0
to type text text

也许你应该重命名你的变量 text ?

于 2012-10-12T12:17:50.953 回答