2020-09-08

wold 批量转PDF

--AppleScript.Word_to_Pdf[By.龙律师一本正经的代码]

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

--Time.20180302

--代码链接https://zhuanlan.zhihu.com/p/34204905

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。