Find format preferences in a script of find/change GREP?
Hi all
I create my first script to search/replace to run GREP queries several at once. But I am struggling to find how to specify the Format to find: preferably in the script that can be in the usual find/replace dialog box.
Here is an example of a line in my script. What I want to achieve is for the line search for words/characters who currently have [standard paragraph] applied and then change the format of a paragraph style particular, I called "team name"...
grep {findWhat: "(.+) ', appliedParagraphStyle: '[standard paragraph]'"} {changeTo: '$1', appliedParagraphStyle: 'The team name'} {} / / apply style name team
BTW, I use the standard FindChangeByList script that comes with Indesign. Any help/comments are appreciated.
See you soon,.
Marco
Instead of the name of the style, try the object of paragraph style:
grep {findWhat: "(.+)", .paragraphStyles appliedParagraphStyle:app.documents [0] [1] ""} {changeTo: '$1', appliedParagraphStyle: 'new style'} {}
Peter
Tags: InDesign
Similar Questions
-
counting in a find change grep
I have a script that runs several find change greps and alert how many each grep search were made.
This is the code:
See section function () {}
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "the (section\\s +?). \\d+ ? [ \\.\\d+]?)";
var changed = app.changeGrepPreferences.changeTo = "$1";
Reference of the changed.appliedCharacterStyle = "cross";
var changes1 = app.activeDocument.changeGrep ();
If {(changes1.length = 1)
Alert (changes1.length + "instance of 'the section' became 'article'.");
} else {}
Alert (changes1.length + "instances of 'the section' changed to 'section'.");
}
};
No matter how many changes I know she took it returns 1.
It also does not apply the character style to the entire reference. The character style is supposed to underline the Word section \d.
He pointed out only half of the section of Word:
section5
Do not know what is happening.
(1) make sure of course, you have the same name "cross references".
(2) when checking a condition use double ==
If (changes1.length == 1) {and NOT so {(changes1.length = 1)
-
Find/change Grep can't find one instance per paragraph, where wrong me?
Hello
I use a find/change Grep to find any price with a comma and change this comma to a thin space (the newspaper style).
But the Grep considers only the first instance of this paragraph.
Example of text...
"$200 $200 000 000 $200,000."
text at the beginning of paragraph $200,000
$200,000 at the end of the paragraph text
$200,000 tab. »
In the sample, the grep would miss the second and third prize on the first line.
I use...
Find...
(?<=\$) (\d{3})\,? ({\d{3})
also tried (\$\d{3})\,? ({\d{3})
Set up...
$1 ~ <$ 2
Is there anything I can add to find these last two prices?
I use this in combination with script Batch find replace, so different greps are set up for 5, 6 and 7 digits starting by $.
Thank you.
Try this,
(?<>
-
Problem with find/change GREP
Hi, try to run by default find/replace InDesign AppleScript script to solve many formatting problems in a large document. One of them is occurences of a two-digit dollar figure followed by a comma (eg. "$ 10") that needs to be changed to have no comma.
Use GREP I can pick it up by searching for "\$\d\d", but when I replace it with '\$\d\d' I get the string "\$\d\d". IE. "$ 10" becomes "\$\d\d" instead of "$ 10." I'm misunderstanding how works the part 'change' grep? Can someone advise?
FYI the line in the search/replace support .txt doc is:
grep {find what: "-\\d\\d$,"} {change to: "\\$\\d\\d"} {include notes: true, include master pages: true include hidden layers: true, any word: false} Remove commas after the price. .. What includes the extra backslashes to escape the backslash which are part of the GREP expression.
Any help much appreciated!
Thank you.
On Grep Pallette, use below syntax to find two or more digit dollar figure followed by a text of commas,
Search: (\$\d+),
Change of: $1
Vandy
-
Of find/change GREP question
Salvation of the Italy,
I need to find each "2" in the words "CO2" and apply (only on the ' 2') index style.
I can't figure out how. If I search all the 2 at the end of a word I also find 2002 and O2, if I find (CO) (2) and replace it with $12 style index applies to the "CO2" not only "2"...
Can anyone help?
Luca
It's a classic: this forum for the shows "CO2 GREP" search this particular application is a good example of Advanced GREP trickery.
Short version: you want to search for it:
(?<>
Read http://forums.adobe.com/message/1285612#1285612 for the long version.
-
Find/change grep allows you to delete repetitive titles?
I am new to scripting grep, which saved me a lot of time with the French documents. I would like to delete repetitive titles.
What I have:
Education
-University of Toronto, Toronto, Canada
Extension to pharma building, 2010
Role: Project Manager
Education
-Concordia University, Montreal, Canada
Extension, 2009
Role: Site Construction Manager
Education
-McGill University, Montreal, Canada
Renovations, 1990
Role: Designer
What I would like to have:
Education
-University of Toronto, Toronto, Canada
Extension to pharma building, 2010
Role: Project Manager
-Concordia University, Montreal, Canada
Extension, 2009
Role: Site Construction Manager
-McGill University, Montreal, Canada
Renovations, 1990
Role: Designer
Hello
\n is not \r
So 2 steps. Using like I told [#1 message]:
+ last regex:
As I've already said, "quickly made operational, but still could be improved!
-
Hi all
I need to insert a linebreak forced after the first comma in each paragraph. If the paragraph contains a comma, no problem but if theres more whether inserts all the af or the last (due to the nature of the grep).
Is there a way to limit the grep for the opener?
I tried the following:
app.findGrepPreferences.findWhat = ' (. +?,)';
app.changeGrepPreferences.changeTo = "$1\n";
and
app.findGrepPreferences.findWhat = ' (. +?,) (. +?) [, *])';
app.changeGrepPreferences.changeTo = "$1\n$ 2 ';
Hope we can nail; (o)
--
molsted
Search: ^(.+?),
Change of: $1, \n
The circumflex accent ^ stands for 'start of paragraph' so he and the lazy operator (as you have already done) combine to restrict the GREP to the first comma only.
Peter
-
one of the scripts in AppleScript 2 (grep + Add hyperlink)
Hello.
I try to combine the two scripts. First digit numbers a greps 7 in indesign
and another, hyperlink, which is the same numbers as this (grep) selection'
Does anyone have idea how to do this. Thank you - Jan
This greps digit number 7 in indesign with this script
say application "Adobe InDesign CS5.5.
Activate
set grep preferences to find
set grep preferences to change
set {find what to find grep preferences to '\\d{7'}
say an active document
set myFoundItems to find grep
end say
end say
and this one hyperlink:
say application "Adobe InDesign CS5.5.
say document 1
set mySelection to selection
the value LinkID to content of mySelection as string
set LinkIDURL to string LinkID
try
set URL_L to do destination URL of the hyperlink name:LinkID destination URL:LinkIDURL} {properties
on error
set URL_L to the URL of the hyperlink destination LinkID
end try
set URL_La to do text of hyperlink source properties {text source: () (point 1 of mySelection), hidden:fake}
set MonLienHypertexte to do { new hyperlink with properties { }destination:URL_L source:URL_La visible:fake}
end say
end say
end
YES! I got it with the help of Indesign scripting quide.
Here's the applescript. Feel free to use if you need. It doesn't work if none of the hyperlinks are not assignet 7-digit, you're grepping with this script
say application "Adobe InDesign CS5.5.
activate
-grep opitonit ettei edelliset resetoi high vaikuta
the value find grep preferences for Nothing
the value grep preferences to change anything
-Asettaa haku in parametrit
define include hidden layers to find change grep options to false
define include locked layers to find to find change grep options to true
-7 number perakkain hakuaehto
{ the value find what to find grep preferences to '\\d{7'}
say an active document
-etsii jokaisen sivulla oleva mallikoodin nimen
the value myFoundItems to find grep
-ottaa ylos jokaisen mallikoodin numerosarjan
Repeat with I have from 1 to (count myFoundItems)
the value Name of the file of content of point i of myFoundItems
if not (there is the URL of the hyperlink destination FileName) then
the value The of to make the URL of the hyperlink destination with properties {name: FileName, destination URL: file name}
on the other
the value The to the URL of the hyperlink destination FileName
end if
-hyperlinkin of lisaa
the value TheHSName of file name
the value TheHS to do source hyperlink text with properties {name: TheHSName, text source: (point I of myFoundItems), hidden: false}
do new hyperlink with properties {destination: the, source: TheHS, visible: false}
end Repeat
end say
end say
-
How to scan a hard copy in pdf format I can convert in word to change?
I have a HP deskjet 3050 a and my operating system is Windows 7, how to scan a hard copy in pdf format I can convert in word to change?
Hello
The software provided for your device does not include OCR functionalityYou can use a solution of OCR 3rd party to analyze as editable text.
If you have Microsoft Office suite, there is a good chance of the suite to provide this type of functionality:
Office 2007 or 2010:
http://www.howtogeek.com/HOWTO/14595/OCR-anything-with-OneNote-2007-and-2010/Office 2003:
http://agsci.PSU.edu/it/how-to/perform-OCR-with-Microsoft-Office-2003-document-imagingKind regards
Shlomi -
Text or Grep in the Find.change script by list?
Want to use grep formatting in this request (instead of text), but the script shows the error:
text {findWhat: ') '} {"changeTo: ')" "} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false}
Why here coexist two ways of writing?
How do you decide?
@Laurent: Hey Hey. After this long history, I always pay attention to the original question...
Mariana:
... because it can combine several characters in a search, for example find a space before the point, period, semi-colon, etc.. Or a space after (or before)...
Yes, it is possible with GREP. Try this for the first:
grep {"findWhat:" ([.,: ;])])} "} {changeTo: '$1'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} remove the space before the period and al.
(Don't forget that the script needs TABS between the sections, as in the original file).
This is a little difficult. In fact, the period is a special character in GREp (it means "any character"), so normally you would need to escape:
(space).
to find a space, followed by a period. However, the square brackets [...] define a group of GOLD, and eliminates the magical properties of the time. Apparently, there is no use for a wildcard character in a group! (It would be something like: "the following characters are allowed: a comma, colon, not at all, a semicolon...") »)
There is a more advanced method to remove the spaces like these. You want to find spaces that are followed by one of these characters and the replacement by anything. It would be
{"findWhat:" (? = [.,: ;])])} "} {" changeTo: ' '}
You can try this in the interface to see that it works.
---
The second can be done by using the Unicode value for ellipsis ('\x{2026}' - find a different rating than in ordinary text), or with the special escape code "~ e". Well yes - there is a different escape character. The backslash is used by GREP itself, but GREP does not own InDesign special characters - include page breaks, single chip and double quotes, dash-to-here, cadratins and a few others. They can also be inserted in the menu on the right side of the search field. These characters need a tilde, so InDesign can 'translate' for something that GREP can be used internally, and GREP never sees. As the tilde is nothing special for Javascript, you can safely insert one in the script data file...
To remove a space before or after an ellipse, you can use this:
grep {findWhat: '? '} ~ e ? "} {changeTo: ' ~ e '}
... but in this case, it may still be easier to stick to the normal text mode (where you would use "^ e" for the suspension points, incidentally).
-
I'm trying to back up my iTunes files, but my classical music has too long file names? If I abbreviate the names of file, iTunes will find these files and play the songs? Also, what is the best way to change a name of file to an album at the same time?
I'm not as familiar with the Windows platform, but if your main drive and the system supports file names that are long which is why your backup drive? You use a different format on your backup disk?
-
From find/change Palette resize InDesign CC
I use ID find replace a lot. I stuck a longer string of text in there today and the window resized to fit the width of the content. (not normal behaviour).
Now I can't reset the palette to its normal size. I have to drag the block in a WAY left off my screen to access the functional buttons on the right; i.e. find then change all. So frustrating.
I tried fixing it by:
Top left option buttons using
By dragging the lower right
Cascading windows
Resetting my workspace
Restarting my computer
Thoughts on what more I can try?
Trashed my ID preferences and all is well now.
I myself will assign suddenly sure of the points for the correct answer... to myself.
Good job JGH!
-
Hello world
Last week, I noticed that all of a sudden I'm not able to find or find/replace in one the 'selection' or 'history', etc. The only option that appears in the search option is looking for 'Document '. I took the ths same problem with 'GREP' and 'Glyph' research last week, but today they seem to work (in the sense that I can search for "selections", etc.) but I'm still not able to search for a 'selection' when I'm trying to find/replace text. I use this feature a LOT, and have only begun to encounter this problem this week. Other than rsetting InDesign preferences, is there anything else I can do all of a sudden pain which is the cause?
Thanks in advance for your help :)
Best,
Christine
UPDATE:
OK... I could no longer bear it and reset the preferences and everything works :) I would have just done that in the beginning :)
-
Find/change the question numbers and create the Table of contents
Hello! I need help to find all my item numbers and apply a paragraph style so I can use them to create a Table of contents page.
The sample numbers
#12345
#12345-5
#12345-20
#12345-ABC
#12345/N
I tried to enter #^? ^ ? ^ ? ^ ? ^ ? in the search/replace and but it is exactly 5 characters after the sign #. I wonder if you can find all characters starting by # and up until the last characters.
Once I found all item numbers, how can I apply the paragraph style to have these characters after the sign #? Because I only want to show item numbers without the # sign on the Table of contents/Index page.
In addition, I have InDesign CS2, which have no function GREP maybe I can do this without the GREP?
I really appreciate any help. Thank you very much.
Are your numbers by themselves in a separate paragraph? OTHERWISE you can not USE the table of contents feature to list all the numbers.
If are, then just look at # in find/replace, then set it to change formatting a new paragraph style (you must create this style in CS2) that you want to include in the table of contents, then as you say, you can use find/replace once more on the history of the TOC to remove the # of all numbers.
-
OSD version 4.1.1.19 is not formatting out of the Script as planned
After upgrading to 4.0 of OSD, I noticed that when I use the output of the script window, it wraps the output of the script to about 80 characters.
When I use the command 'SET SQLFORMAT ANSICONSOLE' it seems to provide me with the long expected rows of data including the headers I expect.
When I close my OSD and restart the packaging back.
I also found that I can not use the performance indicators and to make them work.SELECT /*csv*/ * FROM scott. EMP;
SELECT /*xml*/ * FROM scott. EMP;
SELECT / * html * / * FROM scott. EMP;
SELECT / * delimited * / * FROM scott. EMP;
SELECT / * Insert * / * FROM scott. EMP;
SELECT / * charger * / * FROM scott. EMP;
SELECT / * fixe * / * FROM scott. EMP;
SELECT / * text * / * FROM scott. EMP;
I remember at one point several months back I opened SQLPlus and he did a window exit changes but I wasn't expecting to have an impact in the OSD.
I am running the OSD 4.1.1.19 64 bit on Windows 7 64 bit.
Thanks in advance for any help you can provide.
-Tom
Create a script with all your settings.
Defined in this script to run at login preferences.
Maybe you are looking for
-
Cannot find Scanner Actions tab HP OfficeJet 8600 more software selection
I recently bought the HP OfficeJet 8600. I am running Windows 7. I try to add folder selections to the printer for analysis at the folder option, and I want to configure the scan to E-mail option. I was able to add a folder, but now I can't find t
-
M40-232 and ati x 600 128 MB video ram
I have a toshiba satellite m40-232 with graphics card ati x 600, ati x 600-128 MB dedicated od ram and 128 MB of system ram but I only dedicated. Where can I select o use also system ram? Thank you
-
Satellite Pro L500 - how to turn on hardware virtualization?
Hello Please can someone tell me how to activate it? I have updated the BIOS to 1.9 and still can not see as an option? Secureable tells me that this cell phone it will work, but it's off! Thank you very much
-
When I put my I had, in this new phone, he asks if l want to transfer contacts d who said only to realize joint l d No. with dt of my daughter. I then tried to remove it, but it won't. After a while, he brought a message from locking. I tried wiping
-
Error 619 how VPN on Windows 7 laptops only connection.
Things have already tried. 1 Windows Firewall disabled. 2 uninstalled Symantec Endpoint protection. 3. change settings of VPN security automatic for PPTP, still not good 4 update card driver wireless DW1501, no luck 5. put the rules to Windows Firewa