Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Remove entire Language from document?

Advisor ,
Jun 09, 2017 Jun 09, 2017

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.

TOPICS
Scripting
7.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jun 09, 2017 Jun 09, 2017

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

...
Translate
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

You can change the applied language in the charStyles and paraStyles.

One of the options to the app languages is None.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

Thank you for your reply i'll look into this. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

It worked for me.

Select the text frame where your text is using the selection tool.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

I have a few Text Frames selected and nothing changes.  This should replace All Spanish Text with nothing correct? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

It's always in this format?

Language_1. / Language_2. / Language_3.

(text,point,space,slash,space,text,point,space,slash,space,text,point)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2017 Jun 09, 2017

In JavaScript you must to double the slashes.

Try this string: "\s\/\s.+?\s\/\s"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 09, 2017 Jun 09, 2017
LATEST

Now this is getting Darn Close to what i was wanting. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines