Fargo Loop: Perform an Action on All Headlines in an Outline

Tweet This Post

This script will let you take an action on each and every node in an outline. For this example I am bolding every headline, but you can use if-else statements or what-have-you where I have defined the actionHere () function.

I use Dave Winer's "count headlines" script at the beginning to determine how many headlines there are. Then I use a for loop to (a) perform an action; and (b) move to the next headline in the outline.

The last time the for loop runs is at the penultimate headline, which brings us to the last headline. If the loop ran any longer, the script would freeze. So I repeat the action on the final headline, and I'm done.

Visit the Fargo scripting page in the docs to learn how to install this script, or watch this video.

Changelog

  • 2103-08-12

    • Script introduced.

Last built: Mon, Aug 18, 2014 at 3:38 PM

By Jeffrey Kishner, Monday, August 12, 2013 at 2:49 PM.