indesign print to ps script - need help renaming files

Ok, crazy question… How can i get these indesign files to come out as postscript files without the .indd at the end. Right now the files come out with the originalname.indd.ps, I would like originalname.ps to be output…

thanks!!!

tell application "Adobe InDesign CS2"
	
	-- set postscript to "postscript1"
	set inFolder to my myChooseFolder("ADS ")
	set outFolder to my myChooseFolder("PS ")
	
	set the item_list to list folder inFolder without invisibles
	
	
	repeat with i from 1 to number of items in the item_list
		set this_item to item i of the item_list
		
		set myDocument to open inFolder & this_item with showing window
		
		delay 5
		set myDocument to my myReplace(this_item, "", "")
		
		tell print preferences of active document
			set active printer preset to "postscript"
			set print file to outFolder & myDocument & ".ps"
			set printer to postscript file
		end tell
		print active document without print dialog
		--tell document preferences of active document to set --active printer preset to "postscript"
		
		delay 1.5
		close active document saving no
	end repeat
	
end tell

on myReplace(myString, myFindString, myChangeString)
	set AppleScript's text item delimiters to myFindString
	set myTextList to every text item of (myString as text)
	set AppleScript's text item delimiters to myChangeString
	set myString to myTextList as string
	set AppleScript's text item delimiters to ""
	return myString
end myReplace

on myChooseFolder(type)
	set myFolder to choose folder with prompt "Choose the " & type & "Folder:"
	--Get the folder name (it'll be returned as a Unicode string)
	set myFolder to myFolder as string
	--Unofficial technique for changing Unicode folder name to plain text string.
	set myFolder to «class ktxt» of (myFolder as record)
	if myFolder is not equal to "" then
		return myFolder
	end if
end myChooseFolder

Model: mac g4
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi,

try this, the replace routine is useless with parameters (“”, “”) and also this odd string coercion while retrieving the folders

tell application "Adobe InDesign CS2"
	
	-- set postscript to "postscript1"
	set inFolder to my myChooseFolder("ADS ")
	set outFolder to my myChooseFolder("PS ")
	
	set the item_list to list folder inFolder without invisibles
	
	repeat with i from 1 to number of items in the item_list
		set this_item to item i of the item_list
		set myDocument to open inFolder & this_item with showing window
		delay 5
		set {name:Nm, name extension:Ex} to info for (inFolder & this_item) as alias
		if Ex is missing value then set Ex to ""
		if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
		tell print preferences of active document
			set active printer preset to "postscript"
			set print file to outFolder & Nm & ".ps"
			set printer to postscript file
		end tell
		print active document without print dialog
		--tell document preferences of active document to set --active printer preset to "postscript"
		
		delay 1.5
		close active document saving no
	end repeat
	
end tell

on myChooseFolder(type)
	return (choose folder with prompt "Choose the " & type & "Folder:") as Unicode text
end myChooseFolder

Stefan, thanks for the help!! That script works perfectly!!!

Thanks again!!!:smiley: