Mac 自动处理, Automator word自动转pdf文件

 Word转换成pdf, 不用别存为,操作点好几次。 找到方法发下:

第一步:打开Mac系统自带的Automator软件。

(快捷方式: Alt+空格,输入 Automator 就可以找到了)

第二步:选择新建项目->工作流程->选择 服务

第三步:选择 文件和文件夹>获得指定的Finder项目(向右拖动)>添加需要处理的文件

 

(快捷方式: 直接将文件拖至右边“工作流程窗口”)

第四步:选择实用工具>运行AppleScript>

 

【核心步骤】将下列代码粘贴替换“运行AppleScript窗口”中的全部代码。 把代码替换了即可。

 

 
 on run {input, parameters}  
    set theOutput to {} 
    tell application "Microsoft Word"       
        repeat with thefile in input            
            open thefile            
            set pdfPath to my makeNewPath(thefile)          
            set theActiveDoc to the active document         
            save as theActiveDoc file format format PDF file name pdfPath
            close theActiveDoc saving no        
        end repeat  
    end tell    
    return theOutput
end run

on makeNewPath(f)   
    set d to f as string    
    if d ends with ".docx" then     
        return (text 1 thru -5 of d)  &  "pdf"    
    else if d ends with ".doc" then     
        return (text 1 thru -4 of d)  & "pdf"    
    else        
        return d & ".pdf"   
    end if
end makeNewPath

最后一步:点击右上角“运行”按钮,程序开始自动处理。

保存为服务,

保存后。 就可以在当前文件夹里转出为pdf文件。

 

发表评论