Copy link to clipboard
Copied
I'm pretty sure this is impossible however i figured i would ask. Is there a way to remove all Spanish text from a document? some document all French.
Undestoor. You want to remove texts within textFrames, not just remove or
change the language...
So, you can run a script that selects the texts in the undesired languages
and then change its contents to none ("").
var mySel = app.selection[0].parentStory;
app.findGrepPreferences = app.changeGrepPreferences =
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedLanguage = '$ID/Spanish';
app.changeGrepPreferences.changeTo = '';
mySel.changeGrep();
app.fi
...Copy link to clipboard
Copied
You can change the applied language in the charStyles and paraStyles.
One of the options to the app languages is None.
Copy link to clipboard
Copied
Thank you for your reply i'll look into this.
Copy link to clipboard
Copied
When i select this nothing happens. The trouble (I think) is that English/French/Spanish are in the same Text frame. And i'm wanting to remove all SPanish or French. None of the files use the same wording either. So I was hoping that a script or feature i dont know about in indesign would either delete ALL spanish or ALL french words. Or at least select them so i can hit the delete button.
*** ADDED *****
I might be selecting the wrong thing as well. were you talking about in the paragraph style options>Advanced Character Formats>NONE?
Copy link to clipboard
Copied
Undestoor. You want to remove texts within textFrames, not just remove or
change the language...
So, you can run a script that selects the texts in the undesired languages
and then change its contents to none ("").
var mySel = app.selection[0].parentStory;
app.findGrepPreferences = app.changeGrepPreferences =
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedLanguage = '$ID/Spanish';
app.changeGrepPreferences.changeTo = '';
mySel.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences =
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
Try this.
Copy link to clipboard
Copied
Thanks again for your reply. It doesn't seem that this is working. When i Run it i don't see anything change. I've tried a few variants of this as well.
Copy link to clipboard
Copied
It worked for me.
Select the text frame where your text is using the selection tool.
Copy link to clipboard
Copied
I have a few Text Frames selected and nothing changes. This should replace All Spanish Text with nothing correct?
Copy link to clipboard
Copied
Yes. But the code as I sent you, will only work with one text frame
selected. It'll make the find/change process to all entire parentStory in
the selected text frame.
I'm clear?
Sorry my bad English.
Copy link to clipboard
Copied
Yes i'm understanding your explaining pretty good. If its easier you can type in your language and i'll jsut click the Translate button. its still not deleting the SPanish text from the. Not sure why.
Copy link to clipboard
Copied
So, make a check.
Point your InsertionPoint into the paragraph that is setted to Spanish and
run an alert code to confirm the language's name.
alert(app.selection[0].appliedLanguage.name);
and then, use the result in between " to your find/change code.
Copy link to clipboard
Copied
Ok i see whats going on. Its taking the applied language (From Paragraph/Character styles). SO if i select a text frame Change the character styles to Spanish it deletes them. It works in that case. I just got it too work for that. The trouble is that all the text is dropped to the frame from word document. And i do not have separate Paragraph/Characters styles for the Text frame the information is in. Below is what i'm trying to accomplish. (Hopefully without creating all new character/Paragraph styles.)
From:
Wear protective gloves. / Use guantes protectores. / Portez des gants de protection.
To:
Wear protective gloves. / Portez des gants de protection.
Copy link to clipboard
Copied
It's always in this format?
Language_1. / Language_2. / Language_3.
(text,point,space,slash,space,text,point,space,slash,space,text,point)
Copy link to clipboard
Copied
For the most part. But sometimes it has as BELOW IN BOLD. (Multiple Sets of English/French/Spanish) And thats just this text frame there are a few other text frames that have different text all together. And unfortunately none of the text frames have Separate Character styles for each language.
English French Spanish English French Spanish
App Use Cat / Cat. Util. Applic. / Cat. Uso Apl.: Clear Coating / Incolore, Couche de coul/ Capa transparente
****ADDED*****
I was kind of hoping that there was a find replace option to search out ALL SPANISH words and just replace them with nothing. Like what you did above but without having to be Specified in a Character/ Paragraph style. We have thousands of files that are not set up that way.
Copy link to clipboard
Copied
Hard to find a pattern.
If you want to remove the middle text, you can try to find texts between "
/ text / " and replace it for " / ".
To use GREP find/change you must have a pattern...
Copy link to clipboard
Copied
yeah thats the problem. There really is no pattern. I'm going to mark your above answer correct because it does do what i asked. I'll just need start creating Styles from here on. Thanks for all you help on this.
Copy link to clipboard
Copied
lf.corullon wrote
Hard to find a pattern.
If you want to remove the middle text, you can try to find texts between "
/ text / " and replace it for " / ".
To use GREP find/change you must have a pattern...
This is actually a very good idea to try. Maybe if i can find a grep String that will replace the " / TEXT / " with " / " i wont need to search out actual languages with this.
Copy link to clipboard
Copied
In JavaScript you must to double the slashes.
Try this string: "\s\/\s.+?\s\/\s"
Copy link to clipboard
Copied
Now this is getting Darn Close to what i was wanting.