Skip to content

Instantly share code, notes, and snippets.

@henrik
Created February 5, 2020 17:32
Show Gist options
  • Save henrik/85dcf6c4af2e5ee03d13a1d49d18bdcc to your computer and use it in GitHub Desktop.
Save henrik/85dcf6c4af2e5ee03d13a1d49d18bdcc to your computer and use it in GitHub Desktop.
JXA script (JavaScript AppleScript) to set Photos.app titles ("names") from filenames, but changing the first letter to uppercase.
var Photos = Application("Photos")
var currentSelection = Photos.selection()
for (var item of currentSelection) {
const oldFilename = item.filename()
const newFilename = oldFilename.charAt(0).toUpperCase() + oldFilename.slice(1)
item.name = newFilename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment