Quantcast
Channel: DEVONtechnologies Community - Latest posts
Viewing all articles
Browse latest Browse all 16267

Help with my applescript

$
0
0

I got this applescript from Copilot.

What I want to achieve is to automatically change the value of custom metadata “University” based any university names contained in the file name. Like if the file name has “New York University” then Add New York University to the metadata.

But, this script doesn’t work.

DevonThink 3 中创建一个智能规则并使用 Apple Script 来实现这个功能是可行的。以下是一种可能的方法来达到你的目标:

  1. 打开 DevonThink 3 并导航到你想要设置智能规则的数据库。
  2. 点击菜单栏中的 “工具”,然后选择 “智能规则”
  3. 点击 “添加智能规则” 按钮以创建一个新的规则。
  4. 在规则设置中,选择 “当” 条件为 “名称” 包含 “华北理工大学”“南京师范大学”“南通大学”
  5. “执行” 部分,选择 “Apple Script” 作为操作。
  6. 输入以下 Apple Script 代码来修改文件的自定义元数据 “学校”:
on performSmartRule(theRecords)
    tell application id "DNtp"
        repeat with theRecord in theRecords
            set recordName to name of theRecord
            if (recordName contains "华北理工大学") then
                set customMetadata of theRecord to {学校:"华北理工大学"}
            else if (recordName contains "南京师范大学") then
                set customMetadata of theRecord to {学校:"南京师范大学"}
            else if (recordName contains "南通大学") then
                set customMetadata of theRecord to {学校:"南通大学"}
            end if
        end repeat
    end tell
end performSmartRule

Viewing all articles
Browse latest Browse all 16267

Trending Articles