【发布时间】:2017-12-23 14:23:06
【问题描述】:
我正在使用下面的代码将文件添加到 Evernote,并使用分配给这些文件的 Apple 标签,以便在脚本添加它们时将它们转换为 Evernote 标签。
我使用的脚本运行良好,但有一个问题。我要定位的文件有 2 个标签。
- 测试标签
- 测试
然后我运行脚本,这是在 Evernote 中添加到导入文件的内容。
单字标签加细但是2个或更多的标签在标签周围加上引号。我尝试了几种不同的方法来删除它们,但都无济于事,所以我想我会在这里发帖,看看你们这些好人有什么想法。
这是我正在使用的代码。
local targetNotebook, the_tags
set theFile to alias "Users:thomMacBook:Desktop:Inbox:outbox:test.pdf"
set the_tags to paragraphs of (do shell script "mdls -raw -name kMDItemUserTags " & quoted form of POSIX path of theFile & " | sed 's/^[()]$//g' | ruby -ne 'each = $_.strip.end_with?(\",\") ? $_.strip[0...-1] : $_.strip; puts each if each != \"\"'")
set targetNotebook to "Testing"
tell application "Finder"
set createdFileDate to (the creation date of (theFile as alias))
set modFileDate to (the modification date of (theFile as alias))
end tell
tell application "Evernote"
launch
set theItem to create note from file theFile notebook targetNotebook tags the_tags created createdFileDate
set (modification date of theItem) to modFileDate
end tell
提前致谢
【问题讨论】:
标签: macos tags applescript evernote