It looks like you're new here. If you want to get involved, click one of these buttons!
Looking for an example of a script to selct certain layers in layout, to merge a layer, to size a layer, to perform boolean operation on 2 layers
you can do this easily in a DRC script. See here for details: https://www.klayout.de/doc-qt4/manual/drc.html.
As sample script is:
# NOT between 11 and 17, store the result in 100
a = input(11, 0)
b = input(17, 0)
(a - b).output(100, 0)