InDesign CS 3 Language checking

Hi All,

Is it possible to check language of any document. I am trying to get it, also I want to check any space before punctuation and any Shift+Enter sign in the document.


tell application "Adobe InDesign CS3"
	tell document 1
		get applied language
		--set applied language to "English"
	end tell
end tell

Thanks
Rajeev

Hi

This returns a Language.
Is this what your after?

tell application "Adobe InDesign CS3"
	tell document 1
		set t to name of every language
	end tell
end tell
t --{"English: UK"}

Not sure about your other requests could do with more info!

Hi,

Exactly what I need.

I will modify it as per my requirement.

Thanks

Hi,

I want to check if any character of Shift+Enter and also I want to check any space before comma, or semi colon or colon etc.

Thanks

Hi

How can I validate it.


tell application "Adobe InDesign CS3"
	tell document 1
		set t to name of every language
		if t is greater than 1 then
			display dialog "It is more than one language"
		else
			display dialog "It is one language"
		end if
	end tell
end tell
t --{"English: UK"}

Thanks

Hi,

I got it. And moving forward seek inputs from any one.

See below code:


tell application "Adobe InDesign CS3"
	tell document 1
		set totLanguage to count of every language
		if totLanguage is greater than 1 then
			display dialog "More than One"
		else
			display dialog "Only one"
		end if
		set t to name of every language
	end tell
end tell
t

Thanks
Rajeev

Hi,

Please check where I am doing any mistakes. getting errors of report_folder not defined.


set report_folder to (path to the desktop folder as string)
tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to name of every language
		my write_Report(DocName, totLanguage, t)
	end tell
end tell
t
on write_Report(DocName, totLanguage, t)
	set The_Report to report_folder & DocName & "“Report"
	try
		open for access file the The_Report with write permission
		write totLanguage to file the The_Report starting at eof
		write t to file the The_Report starting at eof
		close access file the The_Report
	on error
		close access file the The_Report
	end try
end write_Report

Thanks

Hi Mac

Does this do what you want.
Placed the line that wasn’t playing nice inside your handler!!

tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to name of every language
		my write_Report(DocName, totLanguage, t)
	end tell
end tell
t
on write_Report(DocName, totLanguage, t)
	set report_folder to (path to the desktop folder as string) -- moved to here
	set The_Report to report_folder & DocName & "“Report"
	try
		open for access file the The_Report with write permission
		write totLanguage to file the The_Report starting at eof
		write t to file the The_Report starting at eof
		close access file the The_Report
	on error
		close access file the The_Report
	end try
end write_Report

Hi,

Yes it is working, but in the report file, it looks like

While I want like

Thanks

Hi

I have modified a little bit, but still not achievable.


tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to name of every language
		set t to t as string
		my write_Report(DocName, totLanguage, t)
	end tell
end tell
t
on write_Report(DocName, totLanguage, t)
	set report_folder to (path to the desktop folder as string)
	set The_Report to report_folder & DocName & "“Report"
	try
		open for access file the The_Report with write permission
		write totLanguage to file the The_Report starting at eof
		write t to file the The_Report starting at eof
		close access file the The_Report
	on error
		close access file the The_Report
	end try
end write_Report

Thanks

Hi Mac

What problem are you getting?
just tested and works fine!

this is my result in a text doc!

Hi,

In my InDesign document they have used more than one language. So I want to write separate.

Thanks

Hi

Not sure if this will work cause i only have one language set in my indesign.
But give it a go and let me know the outcome!!

set Tlist to {}
tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to every language
		repeat with i from 1 to totLanguage
			copy name of item i of t as string to end of Tlist
		end repeat
		my write_Report(DocName, totLanguage, Tlist)
	end tell
end tell

on write_Report(DocName, totLanguage, t)
	set report_folder to (path to the desktop folder as string)
	set The_Report to report_folder & DocName & "“Report"
	try
		open for access file the The_Report with write permission
		write totLanguage to file the The_Report starting at eof
		repeat with n in t
			set n to n as string
			write n & return to file the The_Report starting at eof
		end repeat
		close access file the The_Report
	on error
		close access file the The_Report
	end try
end write_Report

Hi,

The requirement get slightly changed so I have changed the code. See below it is showing only one language in the second language it gives error. See below code.


set TList to {}
tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to every language
		if totLanguage is greater than 1 then
			display dialog "More than One Langauge Used."
			repeat with i from 1 to totLanguage
				copy name of item i of t as string to the end of TList
				display dialog TList
			end repeat
		else
			display dialog "Only One Langauge Used. That is: " & t
		end if
	end tell
end tell
t

Thanks

Hi Mac

Is this any better?

set Tlist to {}
tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to every language
		if totLanguage is greater than 1 then
			display dialog "More than One Langauge Used."
			repeat with i from 1 to totLanguage
				copy name of item i of t as string to the end of Tlist
				display dialog Tlist
			end repeat
		else if totLanguage is equal to 1 then
			repeat with i from 1 to totLanguage
				copy name of item i of t as string to the end of Tlist
				display dialog "Only One Langauge Used. That is: " & item i of Tlist
			end repeat
		end if
	end tell
end tell

Hi,

Now it is working fine, I got hint from your code, thanks.


set Tlist to {}
tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		set totLanguage to count of every language
		set t to every language
		if totLanguage is greater than 1 then
			display dialog "More than One Langauge Used."
			repeat with i from 1 to totLanguage
				copy name of item i of t as string to the end of Tlist
				display dialog item i of Tlist
			end repeat
		else if totLanguage is equal to 1 then
			repeat with i from 1 to totLanguage
				copy name of item i of t as string to the end of Tlist
				display dialog "Only One Langauge Used. That is: " & item i of Tlist
			end repeat
		end if
	end tell
end tell