0

每个月我都会得到我的银行余额,它基本上只是一张桌子。为了更好地了解我的开支,我想将此列表导出到 Numbers (iWork) 文档中。我希望使用 Applescript,这样可以自动执行此过程:)

有谁知道如何将 PDF(文本类型)列表转换为 CSV、Excel 或数字?

4

1 回答 1

1

如果您尝试过任何代码,很高兴看到。此外,如果不查看您正在使用的 pdf 类型如何通过这种过程,就很难知道结果可能是什么。考虑到这一点,这就是我正在谈论的那种过程......

我建议下载并使用精美的可编写脚本的 Skim pdf 应用程序 ( http://skim-app.sourceforge.net/ )。预览太有限了。基本的 Adob​​e 阅读器可能具有足够的功能,但是,我是 Skim 的粉丝。CSV 文件基本上只是文本,所以这应该可以,但同样,不知道您的文本是如何格式化的,我无法确定结果。如果您分享示例,我很乐意进行编辑。以下内容适用于纯文本pdf:

tell application "Finder" to set dt to desktop as string
tell application "Skim"
    set docName to name of document 1
    set baseName to text 1 thru ((offset of "." in docName) - 1) of docName
    set docText to text of document 1
    set filePath to (dt & baseName & ".csv")
    set myFile to open for access filePath with write permission
    write docText to myFile --as «class utf8»--depending on results, you may need this last part. test
    close access myFile
end tell
tell application "Numbers"
    activate -- I got weird buggy results not activating (or at least launching) first.
    open alias filePath
end tell
于 2016-12-26T20:54:28.747 回答