You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取剪贴板中Apple Notes兼容的com.apple.notes.richtext格式内容

获取Apple Notes专属的com.apple.notes.richtext剪贴板内容

你的脚本无法保留勾选清单格式,是因为默认的get the clipboard只会读取通用文本/RTF格式,而Apple Notes的勾选清单依赖专属的com.apple.notes.richtext格式(AppleScript中对应四字符标识«class ANRT»)。要获取该格式内容,需要主动指定类型读取剪贴板,以下是修正后的脚本:

-- 检查剪贴板是否包含Apple Notes专属富文本格式
set hasNotesRichText to false
set clipboardInfo to clipboard info
repeat with infoItem in clipboardInfo
    if infoItem's class is «class ANRT» then
        set hasNotesRichText to true
        exit repeat
    end if
end repeat

if hasNotesRichText then
    -- 获取com.apple.notes.richtext格式内容
    set notesRichTextFromClipboard to the clipboard as «class ANRT»
    tell application "Notes"
        activate
        tell account "iCloud"
            make new note at folder "Notes" with properties {name:"Test Note", body:notesRichTextFromClipboard}
        end tell
    end tell
else
    display dialog "剪贴板中没有Apple Notes专属的勾选清单格式内容,请先复制一条带勾选清单的Notes笔记"
end if

关键说明:

  • «class ANRT»是com.apple.notes.richtext的AppleScript专用标识,通过这个类型读取剪贴板,能完整保留Notes的勾选清单等专属格式。
  • 加入格式检查步骤,可避免剪贴板无对应格式时脚本报错,提升稳定性。

内容的提问来源于stack exchange,提问作者user1092808

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 19:04:59