如何使用 Applescript 从 Excel 工作表填充页面文件
我正在尝试根据 Excel 电子表格中的数据填充模板。这是我第一次尝试 Applescript。我的计划是在模板中使用唯一的文本字符串(即 Value_1、Value_2 等),然后将每个值存储在变量中,并查找每个变量并将其替换为每个字符串。
我非常感谢任何帮助;这是我现在的位置:
tell application "Microsoft Excel"
tell active workbook
activate object worksheet "Page 2"
copy range range "B7" of active sheet
// Store as variable?
end tell
end tell
tell application "Pages"
activate
tell application "System Events"
keystroke "v" using command down
// Find and replace?
end tell
end tell
I'm trying to populate a template from data in an Excel spreadsheet. This is my first foray into Applescript. My plan is to have unique text strings in the template (i.e. Value_1, Value_2, etc) then store each value in a variable and find and replace each variable with each string.
I would very much appreciate any help; here is where I'm at:
tell application "Microsoft Excel"
tell active workbook
activate object worksheet "Page 2"
copy range range "B7" of active sheet
// Store as variable?
end tell
end tell
tell application "Pages"
activate
tell application "System Events"
keystroke "v" using command down
// Find and replace?
end tell
end tell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的事情会做你想要的:
这个脚本不会保持格式化。如果您想继续格式化,也许是这样的:
为此,您需要启用系统偏好设置 -->键盘-->所有控制。
Something like this will do what you want :
This script does not keep formatting. If you want to keep formatting perhaps something like this :
For this to work you will need to enable System Preferences --> Keyboard --> All controls.