Copy link to clipboard
Copied
Hello !
I'm a total newbie at using GREP and I tweaked the FindChangeByList script to find and replace a bunch of little things like double spaces, thin spaces before some punctuations mark, etc.
Everything works like a charm EXCEPT for the the double quotes « and ».
Here is one of the scripts that I use and that works perfectly well :
Just noticed there was an error in the script syntax, which I corrected to :
text {find what:"« "} {change to:"«~<"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Remplace guillemet-ouvrant-espace par guillemet-ouvrant-espace-fine.
I am not a scripter at all, but a long time user of this script and I have adapted many times the FindChange text which is associated to this script. So, no, it is not an error: you use the ~ metacharacter when t
Copy link to clipboard
Copied
In place of [?] use \? you need to escape characters that have special meaning in GREP and ? is one such character so that needs escaping, the escaping is not needed inside a character class that is why enclosing it seems to work for you. For the other replacement just use the character it is not a special character so it would need any escaping nor does it need to be inside a character class
In your first example you are replacing "all space-question mark with a thin space bracket open question mark backet close". Due to this reason you need the second text replace. Instead you could use just a single ind/replace like the following
grep {find what:" \?"} {change to:"~<?"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}
-Manan
Copy link to clipboard
Copied
What dou you want to finally get? A thin space after the opening quote («) and before the closing one (») ?
This works fine, using the FindChangeByList script
text {findWhat:"« "} {changeTo:"«^<"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:false, wholeWord:false} Remplace guillemet-ouvrant-espace par guillemet-ouvrant-espace-fine.
text {findWhat:" »"} {changeTo:"^<»"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:false, wholeWord:false} Remplace espace guillemet-fermant par espace-fine-guillemet-fermant.
Note that this text file comes from JRBoulay web site, who adapted the original one to match the French typographic rules
Copy link to clipboard
Copied
Hey @Manan Joshi and @jmlevy ! Thank you both for you replies.
So I tried both, but I get errors…
@jmlevy yes, I absolutely want a thin space after the («) and before the (»). I have no clue why it works fine with the rest of my script, but not the quote.
I attached the full script. Maybe there's something somewhere that I'm not seeing !
Thanks for your help : )
Copy link to clipboard
Copied
Just noticed there was an error in the script syntax, which I corrected to :
text {find what:"« "} {change to:"«~<"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Remplace guillemet-ouvrant-espace par guillemet-ouvrant-espace-fine.
Now I don't get an error, but it STILL doesn't work 😰
Copy link to clipboard
Copied
Just noticed there was an error in the script syntax, which I corrected to :
text {find what:"« "} {change to:"«~<"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Remplace guillemet-ouvrant-espace par guillemet-ouvrant-espace-fine.
I am not a scripter at all, but a long time user of this script and I have adapted many times the FindChange text which is associated to this script. So, no, it is not an error: you use the ~ metacharacter when the string is a grep one, but as you have seen in my answer, it is a text string and the metacharacter you need to use is ^, not ~.
I can guarantee you that the FindChange text file I use (and the 2 lines I gave you are extracted of this text file) works perfectly.
May I ask if you are a French speaking person and if you want to use French typographic rules? If this is the case, I invite you to download this version of the script here:
I have modified many times this file to match with different needs and it has always worked perfectly, so maybe your error comes from the javascript itself, but unfortunately I cannot help you on this matter.
Copy link to clipboard
Copied
Thanks @jmlevy I'll try that file. Hopefully I don't get an error !
Copy link to clipboard
Copied
There is definitively something wrong in your FindChangeList file but I am unable to understand where the error(s) is (are). If you follow my advice, it should work.
Copy link to clipboard
Copied
Hi @Chillidrop.
The attached file works for me, try it. If it still does not work then share a sample InDesign file that we can test with.
-Manan
Copy link to clipboard
Copied
Hey @Manan Joshi I just tried it and still nothing : (
I created a blank document to try it in, and nothing happened. When I used my old file, the ? worked.
I attached it if you want to try.
I'm so confused haha.
Copy link to clipboard
Copied
Works just fine for me, I used the indd you sent and the txt file that I sent before. See the screengrab at the following link
-Manan
Copy link to clipboard
Copied
Hey @Manan Joshi and @jmlevy
So I finally figured out what was wrong! I was using the applescript file and not the javascript !
@jmlevy I used the file you suggested in javascript and it works like a charm !
Thank you both for you precious advice and time : )