automating-powerpoint
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAutomating PowerPoint (JXA-first, AppleScript discovery)
自动化PowerPoint(优先使用JXA,结合AppleScript检索)
Relationship to the macOS automation skill
与macOS自动化技能的关联
- Standalone for PowerPoint, aligned with patterns.
automating-mac-apps - Use for permissions, shell, and UI scripting guidance.
automating-mac-apps
- 是针对PowerPoint的独立技能,与模式保持一致。
automating-mac-apps - 权限、Shell和UI脚本相关指南请参考。
automating-mac-apps
Core Framing
核心框架
- PowerPoint dictionary is AppleScript-first; discover there.
- JXA provides logic, data handling, and ObjC bridge access.
- Objects are specifiers; read via methods, write via assignments.
- Prerequisites: PowerPoint with Accessibility permissions, basic JXA/AppleScript knowledge.
- PowerPoint字典优先基于AppleScript;可在其中进行检索。
- JXA提供逻辑处理、数据管理以及ObjC桥接访问能力。
- 对象为指定符;通过方法读取,通过赋值写入。
- 前置条件: PowerPoint已获取辅助功能权限,具备基础JXA/AppleScript知识。
Workflow (default)
默认工作流程
- Discover dictionary terms in Script Editor (PowerPoint).
- Prototype minimal AppleScript commands.
- Port to JXA and add defensive checks.
- Use explicit enums for save/export formats.
- Use Excel interop for robust charting.
- 在脚本编辑器(PowerPoint)中检索字典术语。
- 编写基础AppleScript命令原型。
- 移植到JXA并添加防御性检查。
- 针对保存/导出格式使用显式枚举。
- 借助与Excel的互操作实现更完善的图表功能。
Quick Start Example
快速入门示例
Create a new presentation with a title slide:
javascript
const powerpoint = Application('Microsoft PowerPoint');
const doc = powerpoint.documents[0] || powerpoint.documents.add();
const slide = doc.slides.add({index: 1, layout: powerpoint.slideLayouts['ppLayoutTitle']});
slide.shapes[0].textFrame.textRange.content = 'My Presentation';
doc.save({in: Path('/Users/username/Desktop/presentation.pptx')});创建带标题幻灯片的新演示文稿:
javascript
const powerpoint = Application('Microsoft PowerPoint');
const doc = powerpoint.documents[0] || powerpoint.documents.add();
const slide = doc.slides.add({index: 1, layout: powerpoint.slideLayouts['ppLayoutTitle']});
slide.shapes[0].textFrame.textRange.content = 'My Presentation';
doc.save({in: Path('/Users/username/Desktop/presentation.pptx')});Troubleshooting
故障排查
- Application not responding: Ensure PowerPoint is launched and accessible via Accessibility permissions.
- Dictionary discovery fails: Open PowerPoint manually first, then retry Script Editor.
- Export errors: Verify file paths exist and use absolute paths; check enum values match PowerPoint's export constants.
- Interop issues: Confirm Excel is installed and both applications have proper permissions.
- 应用无响应: 确保PowerPoint已启动并已获取辅助功能权限。
- 字典检索失败: 先手动打开PowerPoint,再重试脚本编辑器。
- 导出错误: 验证文件路径是否存在并使用绝对路径;检查枚举值是否与PowerPoint的导出常量匹配。
- 互操作问题: 确认已安装Excel,且两个应用都具备相应权限。
Validation Checklist
验证清单
- PowerPoint launches and responds to JXA commands
- Presentation creation succeeds with expected slides
- Shape/text manipulation renders correctly
- Export produces valid output files
- Enum values match PowerPoint dictionary constants
- Error handling covers missing app/permissions
- PowerPoint可启动并响应JXA命令
- 成功创建包含预期幻灯片的演示文稿
- 形状/文本操作可正确渲染
- 导出可生成有效的输出文件
- 枚举值与PowerPoint字典常量匹配
- 错误处理覆盖应用缺失/权限不足的场景
When Not to Use
不适用场景
- Windows PowerPoint automation (use VBA instead)
- Web-based PowerPoint (use Office 365 APIs)
- Complex animations or transitions (limited JXA support)
- Non-macOS platforms
- Real-time presentation collaboration scenarios
- Windows平台的PowerPoint自动化(请改用VBA)
- 基于Web的PowerPoint(请使用Office 365 APIs)
- 复杂动画或转场(JXA支持有限)
- 非macOS平台
- 实时演示文稿协作场景
What to load
需加载的资源
- PowerPoint JXA basics: (core objects, application setup)
automating-powerpoint/references/powerpoint-basics.md - Recipes (slides, shapes, text):
automating-powerpoint/references/powerpoint-recipes.md - Advanced patterns (export enums, charts):
automating-powerpoint/references/powerpoint-advanced.md - Dictionary translation table:
automating-powerpoint/references/powerpoint-dictionary.md - Charting notes:
automating-powerpoint/references/powerpoint-charts.md - Export to video notes:
automating-powerpoint/references/powerpoint-export-video.md - Excel chart copy example:
automating-powerpoint/references/powerpoint-chart-copy.md - Layout presets:
automating-powerpoint/references/powerpoint-layouts.md - Export video workflow:
automating-powerpoint/references/powerpoint-export-video-steps.md - Deck generator example:
automating-powerpoint/references/powerpoint-deck-generator.md - Chart-aware deck pattern:
automating-powerpoint/references/powerpoint-chart-aware-deck.md
- PowerPoint JXA基础:(核心对象、应用设置)
automating-powerpoint/references/powerpoint-basics.md - 实用技巧(幻灯片、形状、文本):
automating-powerpoint/references/powerpoint-recipes.md - 高级模式(导出枚举、图表):
automating-powerpoint/references/powerpoint-advanced.md - 字典对照表:
automating-powerpoint/references/powerpoint-dictionary.md - 图表相关说明:
automating-powerpoint/references/powerpoint-charts.md - 导出为视频相关说明:
automating-powerpoint/references/powerpoint-export-video.md - Excel图表复制示例:
automating-powerpoint/references/powerpoint-chart-copy.md - 布局预设:
automating-powerpoint/references/powerpoint-layouts.md - 导出视频工作流程:
automating-powerpoint/references/powerpoint-export-video-steps.md - 演示文稿生成器示例:
automating-powerpoint/references/powerpoint-deck-generator.md - 支持图表的演示文稿模式:
automating-powerpoint/references/powerpoint-chart-aware-deck.md