sorry for my last answer, I missunderstood.
hope this helps.
have fun.
# here you can list layernames to set visible
setmyLayerNameListto {"Layername 1", "Layername 2"}
tellapplication "Adobe InDesign CC"
settheDocLinkstolinksofactive document
repeatwithiintheDocLinks
settheGraphicLayerstonameofgraphic layersofgraphic layer optionsofparentofi
repeatwithjfrom 1 tocounttheGraphicLayers
ifitemjoftheGraphicLayersisinmyLayerNameListthen
setcurrent visibilityofgraphic layerjofgraphic layer optionsofparentofitotrue
else
setcurrent visibilityofgraphic layerjofgraphic layer optionsofparentofitofalse
endif
endrepeat
endrepeat
endtell