Make sure the layer is active, because when you work in the Channels list, this make the channel the active drawable and thus the target of the ensuing Curves/Levels/B-C operation. So you have to select your layer again...
As you would expectt, a good deal of this has been scripted.
As you would expectt, a good deal of this has been scripted.