Illustrator click menu

I can seem to click the menu item even though it exists I get a NSReceiverEvaluationScriptError: 4 error

any thoughts ?


tell application "Adobe Illustrator" to activate
tell application "System Events"
	get application processes
	
	tell application process "Adobe Illustrator"
		if exists menu -1 of menu item "Graphic Style Libraries" of menu "Window" of menu bar item "Window" of menu bar 1 then
			click menu item -1 of menu item "Style Libraries" of menu "Window" of menu bar item "Window" of menu bar 1
			
		end if
	end tell
end tell

oops this doesn’t work either though


tell application "Adobe Illustrator" to activate
tell application "System Events"
	get application processes
	
	tell application process "Adobe Illustrator"
		if exists menu -1 of menu item "Graphic Style Libraries" of menu "Window" of menu bar item "Window" of menu bar 1 then
			click menu item -1 of menu item "Graphic Style Libraries" of menu "Window" of menu bar item "Window" of menu bar 1
			
		end if
	end tell
end tell

I think, there is a missing “menu 1”

tell application "Adobe Illustrator" to activate
tell application "System Events"
   -- get application processes
   
   tell application process "Adobe Illustrator"
       if exists menu -1 of menu 1 of menu item "Graphic Style Libraries" of menu "Window" of menu bar item "Window" of menu bar 1 then
           click menu item -1 of menu 1 of menu item "Style Libraries" of menu "Window" of menu bar item "Window" of menu bar 1
           
       end if
   end tell
end tell

Hi Mcgrailm

Does this work:

tell application "Adobe Illustrator" to activate
tell application "System Events"
	tell process "Adobe Illustrator"
		set frontmost to true
		click menu item "Style Libraries" of menu of menu item "Graphic Style Libraries" of menu "Window" of menu bar 1
	end tell
end tell

I don’t have a “Style Libraries” but if i change this to any other of my Libraries it works fine…

Edit: My Apologises MCG this is not what your after i see…!
but please do explain abit more about what you want and i may be able to help if stefan hasn’t sorted it for you… sorry

I thought style libraries was a sub menu of graphic style libraries like default_CMYK is as in this:

tell application "Adobe Illustrator" to activate
tell application "System Events"
	tell process "Adobe Illustrator"
		set frontmost to true
		click menu item "Default_CMYK" of menu of menu item "Graphic Style Libraries" of menu "Window" of menu bar 1
	end tell
end tell

Pidge1,

Yes you are correct thank you.

MM