InDesign add text box to each page

I can’t get InDesign to paste the text box on each page it puts them all on the first page. Any Help


tell application "Adobe InDesign CS4"
	activate
	tell (active document) to set {file_name, doc_pages, page_numbers} to {name, pages, name of pages}
	set issue_number to text returned of (display dialog "Enter the Issue Number" default answer "00") as string
	
	set region_list to {"National", "Arizona", "California COMMON", "California LA", "California OC", "California SD", "California BigBook", "Chicago", "Colorado", "Florida", "New York", "Texas COMMON", "Texas Austin", "Texas Dallas", "Texas Houston", "Texas BigBook", "Winter Common", "Spring Common", "Summer Common", "Fall Common"}
	set ZIP_list to {"NAT", "AZ", "CAL_COM", "LA", "OC", "SD", "CAL", "CH", "CO", "FL", "NY", "TEX_COM", "AUS", "DAL", "HOU", "TEX", "COM_LXWIN", "COM_LXSPR", "COM_LXSUM", "COM_LXFALL"}
	
	set region_code to choose from list region_list with prompt "Choose a Region:"
	tell result
		if it is false then return
		set region_code to item 1 of it
	end tell
	
	if region_code is false then return
	repeat with i from 1 to count region_list
		if item i of region_list is region_code then exit repeat
	end repeat
	set new_code to item i of ZIP_list
	
	set folder_path to (choose folder with prompt "Select folder to Save PDF files") as string
	
	
	set oldPref to page numbering of general preferences
	set page numbering of general preferences to section
	
	set pagesToPrint to (choose from list page_numbers with prompt "Choose Pages to PDF" with multiple selections allowed)
	if pagesToPrint is false then return
	
	set the_filename to file_name
	set prevTIDs to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "_"
	set the_filename to text item 3 of the_filename
	set AppleScript's text item delimiters to prevTIDs
	
	
	repeat with anItem in pagesToPrint
		if length of anItem is 4 then
			set new_number to contents of anItem
		else
			set new_number to text -3 thru -1 of ("00" & anItem)
		end if
		
		tell active document
			set the_frame1 to make new text frame
			set the geometric bounds of the_frame1 to {"-.0257 in", "6 in", "-.4118 in", "9 in"}
			set contents of the_frame1 to new_code & "_LX" & issue_number & "_" & new_number
			set vertical justification of text frame preferences of the_frame1 to top align
			set justification of characters of the_frame1 to left align
			set applied font of characters of the_frame1 to "Helvetica (TT)"
			set font style of characters of the_frame1 to "Bold"
			set point size of characters of the_frame1 to 13
			set fill color of characters of the_frame1 to "Registration"
			set overprint fill of characters of the_frame1 to true
			set vertical justification of text frame preferences of the_frame1 to top align
			set capitalization of characters of the_frame1 to all caps
			
			set PDF_name to folder_path & new_code & "_LX" & issue_number & "_" & new_number & ".pdf"
			set page range of PDF export preferences to (anItem as string)
			tell active document to export format PDF type to PDF_name using "FryPDF" without showing options
			delete the_frame1
		end tell
	end repeat
	set page numbering of general preferences to oldPref
	say "DONE"
	display dialog "Your PDFs are Done" buttons {"Done"} default button 1
end tell
end

Thank You

in your script you are not targeting a page so it assumes page one. You can stem through the pages, which may make sense given the rest of your script or create them on every page at once with a statement similar to this one:

tell application "Adobe InDesign CS4"
	tell document 1
		tell every page
			set theFrames to make new text frame with properties {geometric bounds:{"-.0257 in", "6 in", "-.4118 in", "9 in"}}
		end tell
	end tell
end tell

Thank You Both for the advise when I get a chance I will update the script

Still having trouble with this I cannot get it to put the slug on any of the pages except the first one. Where do I tell it to do this in the script maybe I’m placing it in the wrong place?

If I have read your script right this should work:


tell application "Adobe InDesign CS4"
	activate
	tell (active document) to set {file_name, doc_pages, page_numbers} to {name, pages, name of pages}
	set issue_number to text returned of (display dialog "Enter the Issue Number" default answer "00") as string
	
	set region_list to {"National", "Arizona", "California COMMON", "California LA", "California OC", "California SD", "California BigBook", "Chicago", "Colorado", "Florida", "New York", "Texas COMMON", "Texas Austin", "Texas Dallas", "Texas Houston", "Texas BigBook", "Winter Common", "Spring Common", "Summer Common", "Fall Common"}
	set ZIP_list to {"NAT", "AZ", "CAL_COM", "LA", "OC", "SD", "CAL", "CH", "CO", "FL", "NY", "TEX_COM", "AUS", "DAL", "HOU", "TEX", "COM_LXWIN", "COM_LXSPR", "COM_LXSUM", "COM_LXFALL"}
	
	set region_code to choose from list region_list with prompt "Choose a Region:"
	tell result
		if it is false then return
		set region_code to item 1 of it
	end tell
	
	if region_code is false then return
	repeat with i from 1 to count region_list
		if item i of region_list is region_code then exit repeat
	end repeat
	set new_code to item i of ZIP_list
	
	set folder_path to (choose folder with prompt "Select folder to Save PDF files") as string
	
	
	set oldPref to page numbering of general preferences
	set page numbering of general preferences to section
	
	set pagesToPrint to (choose from list page_numbers with prompt "Choose Pages to PDF" with multiple selections allowed)
	if pagesToPrint is false then return
	
	set the_filename to file_name
	set prevTIDs to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "_"
	set the_filename to text item 3 of the_filename
	set AppleScript's text item delimiters to prevTIDs
	
	
	repeat with anItem in pagesToPrint
		if length of anItem is 4 then
			set new_number to contents of anItem
		else
			set new_number to text -3 thru -1 of ("00" & anItem)
		end if
		
		tell active document
			-- anItem is the page number
			tell page (anItem) to set the_frame1 to make new text frame with properties {geometric bounds:{"-.0257 in", "6 in", "-.4118 in", "9 in"}, vertical justification:top align, contents:(new_code & "_LX" & issue_number & "_" & new_number) as string}
			
			set properties of characters of the_frame1 to {vertical justification:top align, justification:left align, applied font:"Helvetica (TT)", font style:"Bold", point size:13, fill color:"Registration", overprint fill:true, capitalization:all caps}
			
			set PDF_name to folder_path & new_code & "_LX" & issue_number & "_" & new_number & ".pdf"
			set page range of PDF export preferences to (anItem as string)
			tell active document to export format PDF type to PDF_name using "FryPDF" without showing options
			delete the_frame1
		end tell
	end repeat
	set page numbering of general preferences to oldPref
	say "DONE"
	display dialog "Your PDFs are Done" buttons {"Done"} default button 1
end tell
end

Thank you for your help it was really appreciated. Finally got it working.