Quark Xpress to Adobe Indesign CS4 Conversion

I am new to this site so first I hope I am in the correct place for my question. If not maybe someone can direct me.

I am new to applescript and I am converting a script that paginates or places PDF files on a page. I am attaching a small portion of the code that I am having trouble with. It works fine if the application is set to quark xpress but fails if I use Adobe Indesign CS4. Also if anyone knows of a good reference for converting Quark commands to Indesign CS4 please let me know.

Here is the code;

tell document 1 of application “QuarkXPress”

--loop once for each page in the document
repeat with a from 1 to count of spreads
	--set view options so we can see what is happening
	show spread a
	set view scale to fit spread in window


Having scripted both there are no real references for easy conversion. There are some similarities but the scripting dictionaries are quite different, as is the document model. The sample you have below is a good example of this. In Quark you zoom and step through the pages in the document directly. In InDesign these are not document properties, they reside in the layout window so you need to direct them accordingly:

tell application "Adobe InDesign CS3"
	set thewindow to layout window 1
	set spreadCount to count of spreads of document 1
	zoom thewindow given fit spread
	repeat with i from 1 to spreadCount
		set active spread of thewindow to spread i of document 1
	end repeat
end tell