InDesign - Get active document name and file path

Does anyone know how you can get the filename of the current active document. Also, how can you get the file path to the saved file location?
thanks!!

tell application "InDesign CS"
	set thepath to file path of document 1 as string
end tell

hi try this


Tell application "InDesign CS2"
activate
tell front document
--full path and file name
set TheName to get full name as string
display dialog TheName
--File path
set ThePath to get file path as string
display dialog ThePath
end tell
end tell

I have tried to get file name but it is not possible straghtway. You can do start string counting from last to “:” and store in a variable, then you can get it.

Thanks
Rajeev Kumar

Perfect thanks!! If anyone wants it, I use something like this to get part of the filename of the active file:


tell application "Adobe InDesign CS2"
	set DocumentName to name of front document as string
	if DocumentName contains ".indd" then
		set aCount to count every character of DocumentName
		set aCount to aCount - 5
		set DocumentName to characters 1 thru aCount of DocumentName as string
		set DocumentName to word -1 of DocumentName as string
	end if
	display dialog DocumentName
end tell