Script for extreme points?

I am working on oblique weights and need to add points on the extremes. I am familiar with the shif-pen option, but it would be quicker to do it globally.

Does anyone know/has a script to help me out ?

Layers > Add Extremes

Oops... (with red cheeks of shame)


But if you like, you can also do it with a script:

[l.addExtremePoints() for l in Font.selectedLayers]