我想自动化 Swift 中从 Xcode 复制并粘贴到 Keynote 文本字段中的代码格式。格式确实被保留了,但我想更改字体大小(我已经这样做了),并且我想进一步添加行号(这可以使用数字类型的项目符号和列表手动完成)。
我写了一个 AppleScript 程序,它只是改变字体的大小。
我的代码如下所示:
tell application "Keynote"
activate
set ts to the current slide of the front document
tell ts
set theTextItem to its first text item
tell theTextItem
set the size of its object text to 32
end tell
end tell
end tell
此代码将文本对象的大小更改为 32,但我没有找到激活行号的方法(即激活 Bullets 和 Lists.xml 中的数字格式)。