Cheers!
A new problem which is making me crazy… ![]()
(Script needs a photoshop image named PHOTOSHOPIMAGE containing two photoshop layers placed on the InDesign page)
When running the script as you see it below it switches graphics layer 1 on and off on each run.
if i activate this part…
if current visibility of graphic layer 2 is false then
set current visibility of graphic layer 2 to true
else
if current visibility of graphic layer 2 is true then
set current visibility of graphic layer 2 to false
end if
end if
…seperately it switches layer 2 on and of on each run, but if I activate both I get an Error -1728 “Can’t get current visibility of graphic layer 2…”
Another curiosity is if I activate:
set TheLayer to graphic layer 1 of graphic layer options of theGraph
set TheLayerName to name of TheLayer
return TheLayerName
I get the name of the InDesign Document …and I KNOW it points to the layer of the image… how can this be? A bug?
Greatful for any clues!!! ![]()
tell application "Adobe InDesign CC 2014"
	tell active document
		
		set TheGraphics to all graphics of every spread
		repeat with i from 1 to number of items in TheGraphics
			set theGraph to (item i of TheGraphics)
			
			set theGraphicsName to name of item link of theGraph
			
			
			if theGraphicsName begins with "PHOTOSHOPIMAGE" then
				set TheGraphLayers to graphic layers of graphic layer options of theGraph
				--set TheLayer to graphic layer 1 of graphic layer options of theGraph
				--set TheLayerName to name of TheLayer
				--return TheLayerName
				
				tell graphic layer options of theGraph
					
					set update link option to keep overrides
					if current visibility of graphic layer 1 is true then
						set current visibility of graphic layer 1 to false
					else
						
						if current visibility of graphic layer 1 is false then
							set current visibility of graphic layer 1 to true
						end if
					end if
					
					--if current visibility of graphic layer 2 is false then
					--set current visibility of graphic layer 2 to true
					--else
					--if current visibility of graphic layer 2 is true then
					--set current visibility of graphic layer 2 to false
					--end if
					--end if
					
				end tell
			end if
		end repeat
	end tell
end tell