Pasting outline to a layer

Can anyone teach me how to paste an outline to a layer?
Assume I have a copied path, and I want to paste it to all of the selected layers.

You will need your path like as GSPath:

newPath = GSPath()

Same with the nodes that you might want to append to the newPath

newPath.addNode_(newNode)
newPath.setClosed_(True)

and then append this path to your layer:

myLayer.addPath_(newPath)

And so on.

1 Like

Thanks. Okay, how can I read the path from the clipboard?
Also, how can I check if the content of the clipboard is bezier path?

Counterquestion: Would it be okay for you, to copy the path within a script? I mean not to go the way via clipboard? Because this easier.

That would require the user to select the source glyph and the destination glyph"s" at the same time, which sounds like a bad idea.

I’ll put something together to access the clipboard.
Or you need two scripts. One to store the outline and the other to paste it.

I made a script: https://gist.github.com/schriftgestalt/6ef3dda00264486cb479