Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Applescript 如何自动执行注释记号工作流,将幻灯片展平为图像幻灯片以导出到.ppt_Applescript_Automator - Fatal编程技术网

Applescript 如何自动执行注释记号工作流,将幻灯片展平为图像幻灯片以导出到.ppt

Applescript 如何自动执行注释记号工作流,将幻灯片展平为图像幻灯片以导出到.ppt,applescript,automator,Applescript,Automator,我总是在keynote中设计演示文稿幻灯片(因为我发现使用它更容易、更愉快),尽管它们通常需要在运行PowerPoint的windows计算机上演示 为了避免字体、格式等问题,我始终使用以下有效的工作流程: 在keynote中设计幻灯片,通常使用图像和文本 将幻灯片作为jpg文件导出到桌面上的文件夹中 打开一个新的主题演讲 将jpg文件拖动到幻灯片导航器中。这将创建每个jpg的图像幻灯片 将新演示文稿导出到.ppt文件 有没有一种方法可以使此工作流自动化?我想把第2-5步折叠成一步 这是执行此操

我总是在keynote中设计演示文稿幻灯片(因为我发现使用它更容易、更愉快),尽管它们通常需要在运行PowerPoint的windows计算机上演示

为了避免字体、格式等问题,我始终使用以下有效的工作流程:

  • 在keynote中设计幻灯片,通常使用图像和文本
  • 将幻灯片作为jpg文件导出到桌面上的文件夹中
  • 打开一个新的主题演讲
  • 将jpg文件拖动到幻灯片导航器中。这将创建每个jpg的图像幻灯片
  • 将新演示文稿导出到.ppt文件
    有没有一种方法可以使此工作流自动化?我想把第2-5步折叠成一步

    这是执行此操作的AppleScript(在Keynote版本6.2上工作,而不是在版本5上工作):

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

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

    --

    更新:选择新文件的位置

    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
    

    以下是执行此操作的AppleScript(使用Keynote版本6.2,而不是版本5):

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

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

    --

    更新:选择新文件的位置

    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
    

    这太棒了!非常感谢。是否可以调整此设置以打开一个对话框将新文件保存到其他地方?通常我会直接把新的ppt文件放到usb驱动器上。谢谢你帮我塑造这个工作流程…它真的很有用!这太棒了!非常感谢。是否可以调整此设置以打开一个对话框将新文件保存到其他地方?通常我会直接把新的ppt文件放到usb驱动器上。谢谢你帮我塑造这个工作流程…它真的很有用!