Copy link to clipboard
Copied
Hi,
We can get the capitalization of the selected text using the below code. How can we get the case mode(Title Case, Sentence Case) of the selected text.
app.selection[0].capitalization
How can we check what kind of case mode is applied to text??
Copy link to clipboard
Copied
Well you evaluate text capitalization property against its possible enums:
https://www.indesignjs.de/extendscriptAPI/indesign10/#Capitalization.html
Copy link to clipboard
Copied
Hi,
I can get the capitalization for text.
I don't know how to get changeCaseMode for text.
I need to check whether a paragraph has sentence case or title case... So i need to get Case of text. If i use capitalization of selected text return for that case is Normal based on paragraph style property. How can I check a paragraph is sentence case or title case??
alert(app.selection[0].capitalization );
returns the below value.
Copy link to clipboard
Copied
Hi,
You are checking the attributes under Capitalization
so if you need to check the Capitalization means you have to use IF condition with all attributes available in the changecase
Please take a look of the following threads, you may get some idea..
Re: Make a words Sentence Case?
Re: How to check the words of next characters is Capital Leter or not its Urgent!
Re: GREP to convert first letter of all paragraphs from lowercase to uppercase?
Copy link to clipboard
Copied
Hi,
thanks for the links... I will check and come back...
I need to check the case of a paragraph contents based on paragraph style. If the paragraph contents does not have specified case (eg., Sentence case) , i need get those as report. How can i check the case applied to text (paragraph) with my inputs (eg., Title Case)??
Copy link to clipboard
Copied
Hi,
I checked links which you gave... From tat what i understood is, we can change the case of a paragraph using paragraph style.
1. Can we get and check the paragraph case with specific case (user input).
2. If suppose, we are applying cases to the paragraph, how can we handle the text like 2a. (If we apply all caps it will convert 2A, in that case how to handle it??
Copy link to clipboard
Copied
Yes checking and converting is possible, you can try a basic script from the link I gave
Copy link to clipboard
Copied
I read the links which u gave... For tat we need both paragraph style and also case. Based on style and case, we can one case to another case based. But what i need is,
1. Get paragraphs based on style (We can get using findtext with style).
2. Get the case of the paragraph or resultant of step 1. - How to get these??
3. Need to check the case of step 2 with the specific (user case).
If i use both style and case means wrong cases in that specified style will get miss...
Copy link to clipboard
Copied
I think you are assuming that the changeCase function is something like the All Caps attribute. That is not the case so. The function changes the actual text, the attribute merely sets a flag so InDesign knows how to display it.
So you cannot "get the case" as an enumeration or some other predefined value.
> 2. Get the case of the paragraph or resultant of step 1.
Make a copy. Convert this copy to Sentence Case. Compare the plain text. If the result is equal, the original was correct.
It is also possible to read the plain text into a Javascript string and compare this against your desired Sentence or Title Case. For that, read the links tpk1982 provided and adjust so it does not write the result back into the document.
Copy link to clipboard
Copied
For your first question.. the link which I provided have the solution.. Please check again
Copy link to clipboard
Copied
Hi,
From the posts, what i can understand is, we can change the case using style or grep. We can get the capitalization value but cant get the case of the paragraph. So we cant check paragraph case with specific one and generate report. But we change the case.
Thanks all...