InDesign script: rename exported PDFs to reflect name of link on page


I have a script that works wonderfully but, after being given some extra time to tweak it, I’d like to see if there’s a way to rename each exported PDF to reflect the name of the link that is placed on each individual page:

-- Drop files on app
-- Opens template chosen by user
-- Each file is placed on page duplicated from original
-- EXPORT version: export each page individually to a PDF
-- Eventually would like name of file to be used to name PDF

on open theseAds
	set EOY_Proof_Template to choose file with prompt "Please select your End of Year Proof Template:" without invisibles
	tell application "Adobe InDesign CS3"
		open EOY_Proof_Template
		repeat with thisAd in theseAds
				set myPage to (duplicate page 1 of document 1)
				tell application "Adobe InDesign CS3"
					tell rectangle 1 of page 1 of document 1
						place thisAd as string
						fit rectangle given center content
					end tell
				end tell
			on error the error_message number the error_number
				display dialog "ERROR: " & the error_number & ". " & the error_message buttons ("OK")
			end try
		end repeat
		delete page 2 of document 1
		set buttonResponse to display dialog "Would you like to export your pages as PDFs?" buttons {"Yes", "No", "Cancel"} default button "Yes"
		if button returned of buttonResponse is "Yes" then
			tell application "Adobe InDesign CS3"
				set myDocument to active document
				set myName to name of myDocument
				set myPages to pages of myDocument
				set myFolderPath to (choose folder with prompt "Please select the folder you want to save your PDF pages in") as string
				set myStyles to name of PDF export presets
				set myExportStyle to (choose from list myStyles with prompt "Please Choose an Export style") as string
				repeat with anItem in myPages
					set myPageNumber to name of anItem as string
					set myLink to name of link 1 of anItem
					set MyPDF to myFolderPath & myName & myLinks & "_" & myPageNumber & ".pdf"
					set page range of PDF export preferences to myPageNumber
					tell myDocument
						export format PDF type to MyPDF using myExportStyle without showing options
					end tell
				end repeat
			end tell
		end if
	end tell
end open

Programming logic question: Note the line “delete page 2 of document 1” at the end of the first function. It’s to get rid of a blank page that occurs in the repeat. If I remember right, there is a way to eliminate the need for this but my prog. logic is rusty.

Any input is greatly appreciated!