首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使主题工作流程自动化,将幻灯片压平成图像幻灯片,以便导出到.ppt

如何使主题工作流程自动化,将幻灯片压平成图像幻灯片,以便导出到.ppt
EN

Stack Overflow用户
提问于 2014-10-29 17:07:29
回答 1查看 2.1K关注 0票数 0

我总是在基调中设计我的演示幻灯片(因为我觉得使用起来更容易,也更愉快),尽管它们通常需要在运行PowerPoint的windows机器上展示。

为了避免字体、格式等方面的问题,我总是使用以下有效的工作流:

  1. 设计主题幻灯片,经常使用图片和文本。
  2. 将幻灯片作为jpg文件导出到桌面上的文件夹。
  3. 开始新的主题演讲。
  4. 将jpg文件拖到幻灯片导航器中。这将创建每个jpg的图像幻灯片。
  5. 将新的演示文稿导出到.ppt文件。

有什么方法可以使这个工作流自动化吗?我很想把步骤2-5变成一个步骤!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-30 00:34:16

下面是执行此操作的AppleScript (在基调版本6.2上工作,而不是在版本5上):

代码语言:javascript
运行
复制
tell application "Finder" to set f to (make new folder) as text -- create a temp folder to export images
tell application "Keynote"
    tell front document
        export to (file f) as slide images with properties {image format:JPEG, compression factor:95}
        set {h, w, fPath} to {height, width, file of it}
    end tell
    tell (fPath as string) to if it ends with ".key:" then
        set newFile to (text 1 thru -6) & ".ppt"
    else
        set newFile to it & ".ppt"
    end if
    set jpegs to my getImages(f)
    set newDoc to make new document with properties {width:w, height:h}
    tell newDoc
        set mSlide to last master slide -- blank
        repeat with thisJPEG in jpegs
            set s to make new slide with properties {base slide:mSlide}
            tell s to make new image with properties {file:thisJPEG}
        end repeat
        delete slide 1
        export to (file newFile) as Microsoft PowerPoint
        close saving no
    end tell
end tell
tell application "Finder" to delete folder f -- delete the temp folder
on getImages(f)
    tell application "Finder" to return (files of folder f) as alias list
end getImages

重要:在运行脚本之前,幻灯片必须已经在基调中打开。

而且幻灯片必须已经保存,因为脚本使用前面文档的路径将PPT文件保存在同一个文件夹中。

--

更新:选择新文件的位置

代码语言:javascript
运行
复制
set v to ("Volumes" as POSIX file) as alias
tell application "Finder" to set f to (make new folder) as text -- create a temp folder to export images
tell application "Keynote"
    tell front document
        export to (file f) as slide images with properties {image format:JPEG, compression factor:95}
        set {h, w, tName} to {height, width, name of it}
    end tell
    tell tName to if it ends with ".key" then
        set newName to (text 1 thru -5) & ".ppt"
    else
        set newName to it & ".ppt"
    end if
    set jpegs to my getImages(f)
    activate
    set newFile to choose file name default name newName default location v with prompt "Select the folder to save the PPT file"
    set newDoc to make new document with properties {width:w, height:h}
    tell newDoc
        set mSlide to last master slide -- blank
        repeat with thisJPEG in jpegs
            set s to make new slide with properties {base slide:mSlide}
            tell s to make new image with properties {file:thisJPEG}
        end repeat
        delete slide 1
        export to (newFile) as Microsoft PowerPoint
        close saving no
    end tell
end tell
tell application "Finder" to delete folder f -- delete the temp folder

on getImages(f)
    tell application "Finder" to return (files of folder f) as alias list
end getImages
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26636579

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档