identify odd or even pages

this is a script for Quark
is there a way to identify Odd number or even pages

tell application “QuarkXPress”
tell front document
if page number is even then
tell (every picture box whose anchored is true)
set text outset to {“0 pt”, “0 pt”, “0 pt”, “14 pt”}
end tell
else if page number is odd then
tell (every picture box whose anchored is true)
set text outset to {“0 pt”, “14 pt”, “0 pt”, “14 pt”}
end tell
end if
end tell
end tell
end tell

this script was automatically tagged for
color coded syntax by Script to Markup Code
written by Jonathan Nathan

thanks for any help with this

Joe—

Try this:


tell application "QuarkXPress"
	tell document 1
		set pgNum to page number of current page
		if pgNum / 2 mod 1 is 0 then
--do something
		else
--do something else
		end if
	end tell
end tell

If you intend to loop through a document, first get a count of pages, then use that number as your limit condition in the loop, like this:


tell application "QuarkXPress"
	set pgCount to (count of pages in document 1)
	tell document 1
		set pgNum to page number of current page
		repeat with pgNum from 1 to pgCount
			if pgNum / 2 mod 1 is 0 then
--do something
			else
--do something else
			end if
		end repeat
	end tell
end tell

HTH,

Ethan

It’s been a while since I wrote any Quark scripts, but I seem to recall that getting the number of a page can be a problem if someone has used a section start so that, for example, the first page in a document is really page 2. In that case, the number of the page is 1 (its position in the document) but the name of the page is “2”.

So I’d get the name and coerce it to a integer. Which brings up another wrinkle if someone has used section start to assign a prefix, which now has to be filtered out.