Illustrator CS5 + Select Artboard

is it possible to switch between artboards in Illustrator CS5? I’ve tried select an object on the artboard that is not current, but it doesn’t switch the focus to that artboard. Is there a way to make it do that?

im trying to do this as well - any help making a specific artboard active?

I had actually given up on this. There’s nothing in the CS5 scripting guide about switching focus between artboards, and the number of ways I’ve tried to do it have become ever more convoluted and also not very effective. I just gave up on it and went back to working in layers, since those are easy to move around/change focus on/etc.

Walt, I couldn’t see what your problem was with this. Its straight forward with Adobe’s ExtendScript then I looked at the dictionary and it would appear Adobe has not made all things equal. Commands would appear to be missing or I can’t find them where I would have expected. All I seem to be able to do is count them.? Anyhows if you really needed this you could call ExtendScript from your AppleScript.

set boo to "app.activeDocument.artboards.getActiveArtboardIndex()"
set foo to "app.activeDocument.artboards.setActiveArtboardIndex(3)"

tell application "Adobe Illustrator"
	tell the current document
		set abcount to count of artboards
		do javascript foo
	end tell
end tell

The above strings may help you. don’t forget to plus 1 for JavaScript’s zero based indexing. Thought it odd for so many viewings that no one had a solution. :slight_smile:

I don’t know Java


set boo to "app.activeDocument.artboards.getActiveArtboardIndex()"
set foo to "app.activeDocument.artboards.setActiveArtboardIndex(1)"

tell application "Adobe Illustrator"
	activate
	set thisDoc to current document
	tell the thisDoc
		set abcount to count of artboards
		do javascript foo
		tell me to Do_MenuItem("Adobe Illustrator", "View", "Fit Artboard in Window")
	end tell
end tell

--Do Menu Item Subroutine
on Do_MenuItem(Do_MenuItem_ApplicationName, Do_MenuItem_MenuName, Do_MenuItem_MenuItem)
	try
		tell application "System Events"
			tell process Do_MenuItem_ApplicationName
				tell menu bar 1
					tell menu bar item Do_MenuItem_MenuName
						tell menu Do_MenuItem_MenuName
							click menu item Do_MenuItem_MenuItem
						end tell
					end tell
				end tell
			end tell
		end tell
		return true
	on error
		return false
	end try
end Do_MenuItem
--End Do Menu Item Subroutine

A quick run-through revealed two things (Mark I would guess you know this, but I’m throwing it in because I didn’t):

One, Illustrator CS5 numbers artboards beginning with 0, not 1. So if you have a document with two artboards and you want to change between them, you have to change between artboards 0 and 1.

Two, the Java command will change the active artboard, but won’t change the focus to the new artboard in the window, so you have to tell it to do that. I’ve included the subroutine I normally use for this. Mark, if you know how to “fit in window” via Javascript I’d LOVE to how it’s done. I don’t like using the System Events subroutine, because while it is pretty reliable it doesn’t always fire, especially if you’ve used it a lot lately.