C-Command Software Forum

script to identify "unused" tags

The attached AppleScript will identify tags not assigned to any records. I find this handy to identify tags for deletion after moving records between libraries.

The usage notes (below) include a caution for those whose libraries contain mailboxes.

Run time:

  • 1:45 for an 838-record library on MacBook 2GHz.
  • 3:50 for a 1783-record library.

I’ll add a brief note on this script to this sticky at the top of the forum posts.

<Nudge to script authors> Others who write (or have written) scripts or workflows – might want to similarly post a short note about it as a reply to the sticky there. That should help others find your helpful tidbits.

Usage notes:

    E-mail messages in mailboxes are not currently available via AppleScript. So the script will find, as ‘unused’, tags that are not used by files (including messages outside of mailboxes) but which -are- used by messages in mailboxes. If the library contains a mailbox (empty or not), the last “Growl” notification reminds you to check the unused tags for mail messages. - Unused tags do not include 1) built-in EF tags and 2) user-specified “permanent” tags. (User-specified permanent tags start with “!_”; other customizations are possible.)
  • The script operates on -all- library records – i.e., record selection is ignored.
  • Do not change or close front library until script completes. (You can switch to other applications.)
  • Pre-10.8, adjust Growl test as indicated in the code.

New script version
v. 01 attached

  • Fixed mistaken classification as “unused” of empty parent tag with -multiple- used child tags.
  • Fixed case sensitivity – unused tags with different case than a used tag are now classified as “unused”.

v.03 attached

  • Added code for running w/o Growl.

V. 02

  • Addressed a garbage collection issue. (Some unused tags were overlooked in older libraries.)

identify-unused-tags.scpt.zip (16.7 KB)