Indesign CS2, place images, starting from page #

I’ve tried to make an applescript that makes indesign CS2 make a document… Displays a Finder “choose folder dialogbox” then it places all selected images from page 1 to 256 (if there is enough images). BUT some times i want the first image to be placed at fx. page 6 or 3 and not page 1, what to do? is it possible to make a dialog which ask you which page to start from?

Oh, and how do i right align the “myTextFrameRight”?

Im using os x tiger and indesign cs2

I know it looks ugly but it works :slight_smile:

--Makes 256 pages document, width 125mm, height 185mm, facing pages (jumbobog-format).
tell application "Adobe InDesign CS2"
	set myDocument to make document
	tell document preferences of myDocument
		set pages per document to 256
		set page width to "125 mm"
		set page height to "185 mm"
		facing pages
	end tell
	--Set all margins to 10 mm
	set myMarginPrefs to margin preferences
	tell myMarginPrefs
		set top to "10 mm"
		set bottom to "10 mm"
		set left to "10 mm"
		set right to "10 mm"
	end tell
end tell

--Makes auto page number on each page.
tell application "Adobe InDesign CS2"
	tell master spread "A-Master" of document 1
		set myTextFrameLeft to make text frame with properties {geometric bounds:{"175mm", "10mm", "185mm", "25mm"}}
		set myTextFrameRight to make text frame with properties {geometric bounds:{"175mm", "225mm", "185mm", "240mm"}}
		set text of myTextFrameLeft to auto page number
		set text of myTextFrameRight to auto page number
	end tell
end tell

set myReverseOrder to true
--Set placed images width and height
set myPageWidth to 115
set myPageHeight to 175

--Display a Finder "Choose Folder" dialog box. 
set myFolder to choose folder with prompt "Vælg den mappe med de filer du vil have placeret."
tell application "Finder"
	set myFiles to files of myFolder
	set myNumberOfPages to (count myFiles)
end tell

tell application "Adobe InDesign CS2"
	set myDocument to active document
	if myReverseOrder is true then
		set myPageNumber to myNumberOfPages
		set myPageIncrement to -1
		set myPageNumber to 1
		set myPageIncrement to 1
	end if
	-- make a layer with the name "Image layer" 
	tell myDocument
			set ImageLayer to layer "Image layer" of myDocument
		on error
			set ImageLayer to make layer with properties {visible:true, locked:false, name:"Image layer"}
		end try
	end tell
	repeat with myCounter from 1 to myNumberOfPages
		set myFileName to item myCounter of myFiles as string
		set myPage to page myPageNumber of myDocument
		tell myPage
			-- place the image on the "Image layer" 
			set myRectangle to make rectangle with properties {geometric bounds:{"10mm", "10mm", myPageHeight, myPageWidth}, item layer:"Image layer"}
			tell myRectangle
				place myFileName
			end tell
			fit myRectangle given center content
		end tell
		set myPageNumber to myPageNumber + myPageIncrement
	end repeat
end tell

yes - just do:

tell application "Adobe InDesign CS"
	tell document 1
		set thePages to name of every page
		set selectedSpread to (choose from list thePages with prompt "Please choose the starting page you would like to import images into.") as string
	end tell
end tell