Getting Indesign CS scripts to work in CS2

Here’s a brief of what the scripts was meant to do. In our workflow we open several documents at a time and need to “batch” print them to .ps files that are saved to a watched folder for Distiller. Anyway yesterday we switched to CS2. I have one script that works. It’s a script that we seldom use for files that weren’t created with an extension… It works and creates the .ps file. this is that script:

tell application "Finder"
	choose folder with prompt "Save PS files here"
	set targetFolder to result as Unicode text
	tell application "Adobe InDesign CS2"
		activate
		try
			repeat
				set mydoc to active document
				tell mydoc
					set myName to name of mydoc as Unicode text
					tell print preferences
						set active printer preset to "postscript"
						set printer to postscript file
						set print file to targetFolder & myName & ".ps"
					end tell
					print without print dialog
					close
				end tell
			end repeat
		end try
	end tell
end tell

We have another script that does a little more and for some reason I can’t figure it stops seemingly just after setting the print preferences to postscript.
The script’s event log is as follows:
tell application “Finder”
choose folder with prompt “Save PS files here”
alias “Macintosh HD:ToPDF:100linescreen:In:”
end tell
tell application “Adobe InDesign CS2”
activate
get active document
document “AL1.indd”
exists every link of document “AL1.indd” whose status = link out of date
false
exists every link of document “AL1.indd” whose status = link missing
false
document “AL1.indd” contains “.indd”
false
set active printer preset of print preferences of document “AL1.indd” to “postscript”
set printer of print preferences of document “AL1.indd” to postscript file
get document “AL1.indd”
document “AL1.indd”
end tell

This is the script that worked in CS but not CS2:

tell application "Finder"
	choose folder with prompt "Save PS files here"
	set targetFolder to result as Unicode text
	tell application "Adobe InDesign CS2"
		activate
		try
			repeat
				set mydoc to active document
				tell mydoc
					set myName to mydoc
					if (links whose status is link out of date) exists then
						update (links whose status is link out of date)
						display dialog "Some images were updated, you may need to check the final PDF" buttons "Continue" default button 1
						save
					end if
					if (links whose status is link missing) exists then
						display dialog "Document Contains Missing Links" buttons "end script now" default button 1
						if button returned of result = "end script now" then quit
					end if
					if myName contains ".indd" then
						try
							set myName to text 1 thru -5 of (get name of myName)
						end try
					end if
					tell print preferences
						set active printer preset to "postscript"
						set printer to postscript file
						set print file to targetFolder & myName & "ps"
					end tell
					print without print dialog
					delay 0.5
					close mydoc saving no
				end tell
			end repeat
		end try
	end tell
end tell

Anyone see anyhting that would stop the second one?

Thanks a lot in advance.

Never mind…figured it out.
changed set myName to mydoc to set myName to name of mydoc