This content has been marked as final.
Show 8 replies
-
1. Re: CS2: Script to Apply a paragraph style and next style?
[Jongware] Oct 16, 2008 12:09 PM (in response to MT.Freelance)Although not hard to script (*), wouldn't it still be easier to just select the entire text, and <br />i then<br />select "Style then Next Style"? It'd repeat automatically, if your styles are set up properly.<br /><br />You mention a city and county, and you can add these to your styles as Next Style as well. If they happen to be the same, just duplicate it under another name, so you can alter its Next Style setup as well.<br /><br />(*) Ten minutes' work gave me this<br /><br /><pre>a = app.selection[0].appliedParagraphStyle;<br /><br />for (i=1; i<app.selection[0].paragraphs.length; i++)<br /><br />{<br /><br /> a = a.nextStyle;<br /><br /> app.selection[0].paragraphs[i].appliedParagraphStyle = a;<br /><br />}</pre><br />-- and that took so long because I forgot to set a proper [Next Style].<br /><br />(Rest assured: GREP, although mighty, is not <br />i almighty<br /> and can't do wonders. Under CS3 it works pretty much the same.) -
2. Re: CS2: Script to Apply a paragraph style and next style?
MT.Freelance Oct 16, 2008 12:41 PM (in response to MT.Freelance)I could set up the next styles to include the county and city IF there was a consistant progression of
County
City
Store
Address
Phone
County
City
etc.
However, that is not the case.
Some entries have one city in a county. Others have multiple.
Some cities have one store. Others have dozens.
Example:
County
City
Store
Address
Phone
County
City
Store
Address
Phone
Store
Address
Phone
Store
Address
Phone
County
City
Store
Address
Phone
City
Store
Address
Phone
City
Store
Address
Phone
etc. -
3. Re: CS2: Script to Apply a paragraph style and next style?
MT.Freelance Oct 16, 2008 12:46 PM (in response to MT.Freelance)Works well enough.
Thanks!
-mt -
4. Re: CS2: Script to Apply a paragraph style and next style?
[Jongware] Oct 16, 2008 1:17 PM (in response to MT.Freelance)Good -- I was thinking on how City and County related to the rest, and one of the options was how you now describe it.
The script could be enhanced to automatically start anew at every new county (and the Next Style for that is always a city, innit?),
b iff
there is a way to identify these. How do you know where to start for a county, in a list of tens of thousands? Do you know all of'em by name? -
5. Re: CS2: Script to Apply a paragraph style and next style?
(Kevin_Dub) Oct 20, 2008 6:16 PM (in response to MT.Freelance)you dont need a script if you are getting the addresses in EXCEL format...I had to create a pretty big directory a while back and found a simple way to do it without scripts....let me know if you're still interested -
6. Re: CS2: Script to Apply a paragraph style and next style?
MT.Freelance Oct 21, 2008 6:39 PM (in response to MT.Freelance)I've received one MASSIVE XLS file. I don't want this in a big table, although that might have made life easier for applying styles (by column for instance).
I've split that up by state and pulled it into NeoOffice Base database
I've generated text reports from the state lists and the raw text goes something like this:
State Name
Virginia
Network Type
Retail
County
Virginia Beach
City
Virginia Beach
Store
Address_Street
Virginia Beach
VA
12345
(999)-555-1234
Store
Address_Street
Virginia Beach
VA
12345
(999)-555-1234
(etc)
I go through a series of 'Find/Change to remove the Return ^p between each line as needed. Example: I search for "^pVA^p" and replace with ", VA^>" This cleans up all the city/state/zip to one line
Virginia Beach, VA 12345
I do similar things with the State Name, County, City, etc. so that I end up with a record looking like this
State Name ^t Virginia
Network Type ^t Retail
County ^t Virginia Beach
City ^t Virginia Beach
Store
Address_Street
Virginia Beach, VA 12345
(999)-555-1234
Store
Address_Street
Virginia Beach, VA 12345
(999)-555-1234
Store
Address_Street
Virginia Beach, VA 12345
(999)-555-1234
I can then use the prefix on the entries for state, county, & city to do a find/change and apply the appropriate style.
In any case, I did work out a convoluted find/change solution:
I add 3 lines before each of the state, network, county and city. So, each falls into the four line Store Name - address - address - phone next style loop.
Next, I select the entire contents, apply the Style with Next style.
Then, I find/change to remove the three blank lines (find ^p^p^p Replace blank)
Next, search out each of the state, network, county, city prefix and apply the correct style.
Finally, search out each of the state, network, county, city prefix and delete them.
Works lots better than selecting a city, and applying a style, then selecting another city, repeat 4ever... begin.
^_^
If you DO decide to script it out automatically, that would be cool, but I have a passable process now and managed to crank through 8 regions in the time it took me to do 1 the harder way.
This explanation glossed over some of the nit-pick things that have to be taken care of for the Find Change to find what I want and ignore what I don't, but that is the basics.
Kevin, I'd be interested in hearing what you did, as this is likely to be a project again in the future.
Thanks to you both.
-mt -
7. Re: CS2: Script to Apply a paragraph style and next style?
(Robert_Tkaczyk) Oct 21, 2008 11:50 PM (in response to MT.Freelance)if you work on Windows - you can test my SerialReplace tool:
http://www.adobescripts.com/modules/mydownloads/singlefile.php?cid=9&lid=66
you can create set of rules for Search/Replace and use it next time by une button click :)
robin
--
www.adobescripts.com -
8. Re: CS2: Script to Apply a paragraph style and next style?
MT.Freelance Oct 22, 2008 5:19 AM (in response to MT.Freelance)Thank you. However, I'm working on a Mac.
^_^
-mt


