Currently Being Moderated

Batch Remove the First Part of the Captions

The problem has been posted by Tony Gay in this discussion:  Can Aperture import metadata?

 

How to remove a fixed string from the start of the captions of all selected photos?

 

Here is an Apple Script:

I have tested in in Aperture 3.6 on El Capitan, OS X 10.11.4:

This script will get all images you have currently selected in Aperture and remove the first part of each caption. The length of the removed part is determined by the variable "to_drop". set this variable to your text you need to remove.

 

Make a current backup of your library, before you try it.  Test with a small test library.

  • To use the script, launch Aperture and select  all photos, that need the caption fixed.
  • Copy and paste script into an open Script Editor window.
  • Modify this line :   set to_drop to the count of "your useless text " -- replace "your useless text" by the string that needs to be dropped from the start of the captions

 

-- ------------------------------------------------------------------------------- ----------------------------

-- This script will remove the first part of the caption of all currently selected images.

-- The length of the dropped part is determined by the variable "to_drop".

 

-- Select all images that need modifying the caption at once in Aperture, then click the Run button

-- Author:  Léonie

 

tell application "Aperture"

 

  set to_drop to the count of "your useless text " -- enter here the string that needs to be dropped from the start of the captions

  activate

  set imageSel to (get selection)

 

  if imageSel is {} then

  error "Please select some images."

  else

  repeat with im in imageSel

  tell im

  try

  -- return the name of every IPTC tag

  if exists IPTC tag "Caption/Abstract" then

  set old_caption to the value of the IPTC tag "Caption/Abstract"

  set new_caption to get rich text to_drop thru (the count of old_caption) of old_caption

  set the value of the IPTC tag "Caption/Abstract" to new_caption

  end if

  error "IPTC tag" & "Caption/Abstract" & "does not exist"

  end try

  end tell

  end repeat

  end if

 

end tell


Replies

Delete User Tip

Are you sure you want to delete this user tip?