惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
IT之家
IT之家
博客园_首页
量子位
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
博客园 - 聂微东
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

alexwlchan’s notes

What is WS11 1DB? Blocking referrers with Caddy How to type a Spanish question mark (¿) on a Mac Non-overlapping type comparisons and Python type checkers Why does t.Setenv panic after t.Parallel? Use Path.glob() and Path.rglob() for typed versions of glob.glob() Curious clocks and colourful eyes Track which templates are used by Jinja2 Archeologists distinguish between “sherds” and “shards” A single command to test all my changed Go packages Disable the new message animations in WhatsApp Finding high-churn folders that bother Backblaze Always-on SSH agent forwarding with my Git pushes Goodhart’s and Campbell’s Law are different Notes from The Cornishman No. 176 (Spring 2026) Notes from The Cornishman No. 176 (Spring 2026) GitUp can’t diff text files larger than 8MB Home Testing the width of a page on a mobile device using Playwright Disable AirPods charging notifications Start a Caddy server in a subprocess during a Python session Filter a list of JSON object based on a list of tags HOME_GET_ME_HOME is a Citymapper Shortcuts action The FileExistsError exception exposes a filename attribute The red-lined bubble snail Why can’t Python connect to example.com? Useful type hints for Python How to truncate the middle of long command output AirPlay Receiver can interfere with Flask apps What’s the main prefix in SQLite queries?
Managing the caption of a photo with AppleScript (but not...
2026-06-29 · via alexwlchan’s notes

Get/set the description of the corresponding media item in the Photos app.

In the macOS Photos app, you can set a “caption” for a photo (select Window > Info, then look for the Caption field below a photo).

As far as I can tell, the only way to manage this caption programatically is using AppleScript – it’s not exposed to the PhotoKit APIs.

Get the description

Look at the description field of a media item from the Photos Suite. Here’s a script that takes a local identifier as an argument, and prints the caption (if set):

#!/usr/bin/env osascript

on run argv
  set targetId to item 1 of argv

  tell application "Photos"
    set targetMedia to media item id targetId
    set desc to description of targetMedia
    
    if desc is missing value then
      return ""
    else
      return desc
    end if
  end tell
end run

Set the description

Set the description field. Here’s a script that takes a local identifier and new caption as arguments:

#!/usr/bin/env osascript

on run argv
  set targetId to item 1 of argv
  set newCaption to item 2 of argv

  tell application "Photos"
    set targetMedia to media item id targetId
    set description of targetMedia to newCaption
  end tell
end run