Apply labels by application type

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

While I was out on leave for the arrival of our new child, Kirk McElhearn published a hint here one Friday about how to find the Intel-native apps on your Mac. Today’s geeky entry is a follow-on to that hint, and it goes one step further. Using an AppleScript, we’ll actually apply color labels to each type of application.

The first step in using this hint is to get the script. That link should open Script Editor for you (you may see a warning about an external protocol handler first), and insert the code for the script. If it doesn’t, you can copy the source, open Script Editor, and paste it into a new script. I’m not going to try to explain every line of the script, but here’s how it works in general:

  1. Run the System Profiler report for your machine.
  2. Grab the Applications and Extensions section of the report.
  3. Loop through the report, looking for applications.
  4. Based on the value of certain found text, set a color label variable for the application.
  5. Use the Finder to apply the calculated label.

The script will look for the three major types of applications: Intel, which is a program that will run only on an Intel-powered Mac; PowerPC, code that will run on both PowerPC and Intel (via Rosetta) Macs; and Universal, code which runs natively on either PowerPC or Intel Macs. You can assign a color (or lack of color) for any of these application types. As provided, the script will color Universal applications green (“green means go!”), PowerPC applications blue, Intel-only applications yellow, and any “other” application types will be orange. You can easily change this by editing each line this section of the code:

	if the_line contains "Intel" then

set app_type to 3
else if the_line contains "Universal" then
set app_type to 6
-- set app_type to 0
else if the_line contains "PowerPC" then
set app_type to 4
set app_type to 1
end if

One suggested edit is already included—by uncommenting (remove the -- at the start of the line) the set app_type to 0 line, and commenting the line immediately above it (add the -- at the start), your Universal applications will have no labels. Why might you want to do this? On an Intel Mac, most of your apps may be Universal, as seen here (note also the blue PowerPC app and the two Intel-only apps):

That may be too much green for your eyeballs; using the above edit, those applications would have no label applied. Feel free to change any of the other colors as well—the code numbers for each color are included in the body of the script.

Once you’ve made your edits, save the modified script, and click Run in Script Editor’s toolbar. Now wait until you see the Run button become active again (this can take a couple minutes). That’s it, you’re done—switch to the Finder, and you’ll see all your labeled applications.

Finally, if you run this, then decide you’d rather not have any labels, change every set app_type to … line to read set app_type to 0, then run the script again. Zero means “no label,” so you’ll clear everything by setting all applications back to color zero.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon