[CS2][JS]Find/Change/Expand Help....

Please i really can't get this done or have no idea how to. There are people who helped me do this function but i don't know how to apply it in my actual file.
app.findPreferences = app.changePreferences = null;
app.findPreferences.appliedCharacterStyle = 'cbib';
var myFound = app.activeDocument.search( '' );
for (j=0; j > myFound.length; j++)
var LamanNgCbib = myFound[j].contents.slice(1,-1);
var dar = LamanNgCbib.replace(/\uFEFF/g, '');
var expanded = unrange(dar);
app.activeDocument.search( dar, false, false, expanded )
function unrange (s)
return s.replace (/(\d+)\u2013(\d+)/g, expand)
function expand ()
var expanded = [];
var start = Number (arguments[1]);
var stop = Number (arguments[2]);
for (var i = start; i <= stop; i++)
expanded.push (i);
return expanded
The script only replaces the first instance ([1,3,5-7] becomes [1,3,5,6,7,8]) but the rest does not. so i have to run the script again for the others to unrange and wait forever 'til the script finished. Is there anyway to loop my search and replace so i have to run the script only once? Please i really need your help scripters.

Your loop is wrong.
You should be using:
for (j = myFound.length - 1; j >= 0; j--)
Because you're changing the text, it is vital that you iterate backwards.
Your loop doesn't even iterate because you have the comparison the wrong way around.
Dave

Similar Messages

  • Find/Change wildcard help

    I'm working on a directory and need to apply a character style to certain areas in CS3. Is there a way to use a wild card to find "any word?" For example, I need to find the following and apply the style; name, tab, number, tab, any character, tab.
    Having ID find the name portion, which can vary in character length, is what I can't quite figure out, I've got the rest figured out.

    Here's is a sample of how it is structured:
    [Start of paragraph]Joseph[tab]4[tab]GV[tab]Address
    I need to be able to change everything BEFORE the "Address" field to a Character Style. Obviously, all 3 fields are variable from line to line, but every line that needs to change is precisely structured as the sample except the character count in each field can change (the number field may contain 1 or 2 numbers and the code field may contain one or two characters). I've played with the GREP function a bit, but still can't figure it out.
    Thanks,
    Jeremy

  • I cannot find information to help me change the orientation of a video filmed in portrait format but only able to be played back lying on its side  (landscape) instead of upright. All the rotation buttons for iPhoto are not 'engaged' when it is in video .

    I cannot find information to help me change the orientation of a video filmed in portrait format but it can only able to be played back lying on its side  (landscape) instead of upright. All the rotation buttons for iPhoto are not 'engaged' when it is in video .

    Thanks OT,
    I tried the Export function but it would not allow me to choose the option of exporting to iMovie. I think you are right about needing Quicktime Pro. I opened iMovie and imported the clip from iPhoto and with some searching found the 'cropping, rotation' mechanism. So I now have a copy in the correct orientation. I plan to import/export it back to iPhoto because I want to have a copy on my iPhone to show people and I wanted to have it available as part of a slideshow I am making in iPhoto of my recent overseas trip. It is a pain that there is no simple orientating tool for the movie clips downloaded to iPhoto with the photos from the one camera.

  • I have CS2. I shot RAW files with my Nikon D90 and now cannot open them in PS.  I heard there was a plug-in to download for this, but cannot find it. Help?

    I have CS2. I shot RAW files with my Nikon D90 and now cannot open them in PS.  I heard there was a plug-in to download for this, but cannot find it. Help?

    You would need at least CS3 with ACR 4.6 to natively edit NEFs from a D90 in PS:
    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    It might also work to use the DNG Converter 4.6 or newer to convert the NEF files to DNGs and then those might open in your older CS2 ACR, but I’m not sure, since it’s a 9 year old program I haven’t used in years.
    The DNG Converter can be found, here:
    http://www.adobe.com/downloads/updates.html

  • Find/Change help with wildcard numbers...

    hello... i'm looking for help with wildcards...
    i have a specific task to complete.. i need to add dash & space into a space in a string of letters and characters...
    here
    221kbps - 00:28:34space dash space here47Mb - 44.1 kHz
    198kbps - 01:27:43 41Mb - 44.1 kHz
    215kbps - 00:34:52 156Mb - 44.1 kHz
    225kbps - 00:32:14 54Mb - 48 kHz
    so my finished text will look like this
    221kbps - 00:28:34 - 47Mb - 44.1 kHz
    198kbps - 01:27:43 - 41Mb - 44.1 kHz
    215kbps - 00:34:52 - 156Mb - 44.1 kHz
    225kbps - 00:32:14 - 54Mb - 48 kHz
    there are many variables to the text - but i thought perhaps i could create a wildcard digit find/change based on the Mb bit, replacing the single space with space dash space
    BUT
    i need to retain the numbers before the Mb
    so my question - is it possible to RETAIN WILDCARD NUMBERS?
    merci beaucoup!

    omg... just fell of my chair
    tried it in text - no joy...
    tried it as a grep.
    YES YES YES
    thankyou so much - i have about 18,000 to format for a music website...
    www.littledogdiscs.co.uk
    if you ever find your way to our neck of the woods in the South of France - please do visit my b&b
    www.maisonverdigris.com
    i have a bottle of vintage champagne with your name on it...
    thanks
    teresa

  • Find/Change GREP - FindChangeByList - help!

    Hi,
    Can anyone help with my GREP problem? I have a long unformatted list of products, I need a couple of GREP find and change queries to help format the list. The formatting will be based on paragraph styles for product header, description and product code. I have GREP working correctly to find the product code lines and apply the 'product code' paragraph style, but I'm struggling to target the product header line. The product header is on the next line after the product code, or it could be found on the line above the product description. I need GREP to find the product header to apply the product header paragraph style. I'm looking at using FindChangeByList; so far I have the folowing:
    grep
    {findWhat:"(Product Code|Product code)$"}
    {appliedParagraphStyle:"Product Code-green"}
    The above line finds all the Product Codes and applies the paragraph style. It works perfectly well from Indesigns Find/Change panel and FindChangeByList.
    But the next bit doesn't work:
    grep
    {findWhat:"^(?<=\\r)", appliedParagraphStyle:"Product Code-green"}
    {changeTo:"", appliedParagraphStyle:"Product Header-green"}
    I've tried to target the 'Start of a paragraph (^)' (this will be the product header) that has - 'Paragraph Break (\r)' with the 'Product Code-green' applied (this is the product code), in front of it. - (Am I right in thinking that in the FindChangeByList script I need 2 slashed on \\r - I have tried with 1 and 2 - no joy.)
    If I do this in Indesigns Find/Change panel it does kind of work. If I click find, it will find the correct point, and click change, it will apply the correct style to the product header - BUT if I click CHANGE ALL - it doesn't work. It reports '0' instances found, yet if i click Find again it will find the next instance. So it's kind of working on an individual click and find basis, but not on global change all - STRANGE? And it doesn't work at all when run from FindChangeByList.
    Anybody got any thoughts on why this is happening? or a better piece of GREP to try? Would really like it to be running from FindChangeByList. Hope the above makes sense.
    Thanks

    Hi,
    You can go straight or try to modify 'MultiFind' script.
    I suggest to use a text conditions and go straight with this code:
    var
              mDoc = app.activeDocument,
              mCond = mDoc.conditions.item("mFound"),
              mPath = "~/Documents/ID_words_to_find.txt",
              mDelimiter = ",",
              mSource = File(mPath),
              mOpen = mSource.open("r",undefined,undefined),
              len, len1, mWordsArr, mFound;
    if (!mCond.isValid)
              mCond = mDoc.conditions.add({
                        name: "mFound",
                        indicatorColor: UIColors.LIGHT_BLUE,
                        indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT,
                        underlineIndicatorAppearance: ConditionUnderlineIndicatorAppearance.SOLID
    if ( !mOpen) {alert ("Can't open a source file"; exit()};
    mWordsArr = mSource.read().split(mDelimiter);
    len = mWordsArr.length;
    app.findTextPreferences = null;
    while (len-->0) {
              app.findTextPreferences.findWhat = mWordsArr[len];
              mFound = mDoc.findText();
              len1 = mFound.length;
              while (len1-->0)
                        mFound[len1].appliedConditions = [mCond];
    app.findTextPreferences = null;
    How it works (should)?
    Assumed:
    - a list of words to find is in a .txt file as comma-delimited (you could set other delimiter)
    - this file is named 'ID_words_to_find'  and saved in user Documents folder (you can change mPath)
    Script define a condition 'mFound' and apply it to every word from your list found in a document. They are highlighted. You can modify them.
    Notice: to remove a condition (highlight) modify a word including a space before it.
    Enjoy:)
    Jarek

  • Help for find/change glyphs script

    Hi everyone!
    I need help for creating a script (or modifying existing script) that should replace every Cyrillic character  from an old ASCII font with the same Cyrillic character but from new Unicode font.
    For example: Capital letter 'A' GID=107 from old font (Lazurski) should be replaced with 'A' GID=630 from new one (Myriad Pro).
    I can do this by using Indesign Find/Change - Glyphs, but this will take me too much time.
    So, I need a scrip for this job.
    My first attempt was to use the FindChangeByList script by modifying the FindChangelist.txt document, but without success.
    Here is what I've used until now:
    1)  glyph {glyphID:107, appliedFont:"Lazurski"} {glyphID:630, appliedFont:"Myriad Pro"} {caseSensitive:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
    2)  glyph {findWhat:"u00C0", appliedFont:"Lazurski", fontStyle:"Bold"} {changeTo:"0410", appliedFont:"Myriad Pro", fontStyle:"Bold"} {caseSensitive:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find ASCII A replace with Unicode A.
    Both lines didn't change anything. What is wrong?
    Any help is welcome!
    Regards,
    Veselin
    P.S. Indesign CS5

    Thank you Jongware!
    The codes (both ID and Unicode) are correct for sure, but even with correct notation (obviously my was wrong) the script don't change anything.
    Here is the line in the FindChangeList:
    text {findWhat:"\u00C0", appliedFont:"Lazurski", fontStyle:"Bold"} {changeTo:"\u0410", appliedFont:"Myriad Pro", fontStyle:"Bold"} {caseSensitive:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find ASCII A replace with Unicode A.
    Update:
    Finally, I found what is wrong with the script - the properties "caseSensitive:false".
    By removing that properties the script works fine.
    So, I successfully converted a book with old ASCII Cyrillic font to Unicode Opentype font.

  • JS:CS3 Newbie needs help! find/change character styles

    I'm new to scripting and JavaScript is giving me a headache, but I'll keep trying. What I'm trying to do is automate a few things so that the production time of our school newspaper is reduced while insuring accuracy.
    I've played around a little with the text find change sample and the changing or adding paragraph styles in the InDesignCS3_ScriptingGuide_JS.pdf and I barely understand what I'm doing.
    When us page designers receive text to place in the document, our editors mark the text with tags like: < b >text< / b >, where the word "text" is to be bolded. (there wouldn't any spaces between < and b and > etc. I just did that so It'll show up here). We have basic character styles and paragraph styles set up, and we just started working with nested styles.
    Is there a way we can search for the < b > tag and bold everything after it up until the < / b > tag? Sort of the way it does for html (the way it would do for this message if I took out the spaces). It'll be great if it could remove the tags as well, but if not, I know I could create a find/change script to do the removal afterwards.
    I appreciate any input.
    Thanks!

    You've not found yourself the easiest of tasks! You need GREP find/replace, not text. Do you have any experience with GREP? It's worth investigating, it's a powerful feature. The script below handles bold. For clarity, it doesn't do any error checking: it assumes that there's a document with text in it and that the document contains a character style called 'bold'.
    // talk to Indesign, nobody else
    #target indesign
    // reset the Find/Change dialog
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // find everything between <b> and  (including these codes)
    app.findGrepPreferences.findWhat = '<b>.+?</b>';
    // add 'bold' style
    app.changeGrepPreferences.appliedCharacterStyle = 'bold';
    // make the changes
    app.activeDocument.changeGrep();
    // now delete the <b> and </b> codes
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = '</?b>';
    app.changeGrep();
    You can adapt it easily to handle other codes, and at a later stage you could generalise it so that you needn't repeat whole bunches of code.
    Good luck with your first forays. Again, it's not the easiest of tasks, but it's worth getting to grips with.
    Peter

  • Find/Change HELP

    Hi,
    Anyone know the code for find/change command on text for specific pages?
    Example: I want to change some text from page 20 to 40 -
    Please help

    There is no such code.
    You can select all the text you want and apply your changes to "Selection" only. (Of course you can only select contiguous text -- that is, all of the text frames should belong to a single running story.)

  • Help with uppercase letters in Find/Change

    Hiyis. I'm trying to change all instances of "US" to "U.S.," but when I type it into Find/Change, I'm getting stuff like "discuss" highlighted. Any way to specify just uppercase US on its own? Or do I have to go through and review every suggested change?
    Thanks tons!

    Click the icons for case sensitivity and whole word in the dialog:

  • Help with Find/Change and wildcards

    I have indesign CS5 and I'm working on a document that has math examples throughout such as 9-1=8. The proofreader said we need to change it to have a space between each digit and math symbol to be 9 - 1 = 8. How can I do this? When I go to Find/Change I have the option of wildcards in the Find, but not in the Replace.
    Also the dash in these equations need to be changed to en dashes. How can I tell indesign that anytime is sees such an equation the dash needs to be changed? I don't want to just change all dashes as I have many dashes that need to stay.

    I do it in two steps, first changing the hyphens to en-dashes:
    Find (?<=\d)-(?=\d) which finds any hypen between two digits
    Replace ~= which is the en-dash
    Then use a class to hold the math symbols:
    Find (\d|\))([\+\*/~==])(\d|\()   (this adds open and close parentheses to the search before or after a symbol -- if your equations don't use parentheses you can eliminate the |\( and |\) from the first and last search groups)
    Replace $1 $2 $3  (there's a space between the terms there).
    This does not include radicals, or advanced math symbols in the search, so if your equations use those, you need to add them, and it doesn't put spaces between digits and parentheses.

  • JS for Find/Change

    I am a novice with JS, but trying to make a couple of enhancements to workflow using scripting. I have managed to figure most things out ok, but usually just need a little kickstart. What I am trying to do is:
    InDesign CS2
    Find a specific sequence of characters in a text selection (in this case, " - " (that is space dash space) and replace with end of nested style & forced line break (^h^n). At the same time, search for double carriage returns and change to single carriage returns (^p^p => ^p).
    Currently, using the Find/Change Function from the Edit menu but I'd like to be able to just apply a script to do it all. I have tried to dig through the archives for a similar posting, but haven't had a lot of luck. If anyone can please point me in the right direction, it would most certainly be greatly appreciated!
    Thank you in advance.
    -Scott

    Thank you Peter ... I have just purchased the electronic version of the O'Reilly book that you recommend. This will certainly help.
    One thing that is not clear ... can I use characters such as "^p" or "^h" directly when setting my parameters, or is there a unicode equivalent that I would need to use?
    Thanks again.
    -Scott

  • Find/Change object size

    We have a document where each page header/number needs to be changed to a different language. We can find change the text ok but when the text is changed the text box is too small. Unfortunately the headers are not on master pages and the colours vary depending on the background colour.
    How can we do a find/change for the size of the text box?
    We want a text box of size 5mm x 20mm to change to 5mm x 35mm, expanding to the right.
    As far as I can see there is no way to do this with the inbuilt find/change object. Any ideas?

    I think you're doing it a weird way, but who am I to criticise, I've done far weirder things.
    If you don't want to add this to the master page then that's fine, I think you'd be better off and it would make things easier in the long run.
    For changing the width of a frame you'd need a script to that, and I really cannot help you on that one, scripts are not my forté.

  • Find/Change Item Numbers and create Table of Contents

    Hello! I need help to find all my item numbers and apply a paragraph style to it so I can use them to create a Table of Contents page.
    Sample item numbers
    #12345
    #12345-5
    #12345-20
    #12345-ABC
    #12345/N
    I tried entering #^?^?^?^?^? on the Find/Change box and but this will find exactly the 5 characters after the # sign. I wonder if you can find all characters starting with # and until the last characters.
    Once I find all the item numbers, how can I apply the paragraph style for only those characters after the # sign? Because I only want to show the item numbers without the # sign on the Table of contents/Index page.
    By the way, I have InDesign CS2 which have no GREP function Maybe I can do this without the GREP?
    I really appreciate any help. Thank you very much.

    You actually have two problems here. The first is to assign the paragraph style. For that you can use GREP.
    Find #\d+ and leave the change field blank, but in the change formatting pick the paragraph style. Stricly speaking you only need to find #\d or even just # because a paragraph style applies to an entire paragraph, so assigning it to any character inthe paragraph will assign it to the entire paragraph.
    Which is your second problem. The TOC is based on paragraph styles and will include all of the text in each paragraph (up to the character limit for a TOC entry, which I think is 256 characters). You can't make a TOC and only use some of the paragraph. For that you need to use an index, or you need to make hidden or non-pinting frames with only the exact text you want in the TOC and assign a unique style to those.
    It's also possible someone has written (or could write) a script that can find text strings that match a pattern such as your numers, assign a character style to them (you could actually do that part in the paragraph style by adding a nested GREP style), then making a list of the text strings along with the page number on which they appear -- almost the same as an index except it would be based on character style, not an index marker.

  • I am trying to authorize my computer and I get an error message: The required directory was not found or has a permissions error. Correct this permissions problem and try again, or deauthorize this computer if the permissions cannot be changed. Help?

    I am trying to authorize my computer and I get an error message: The required directory was not found or has a permissions error. Correct this permissions problem and try again, or deauthorize this computer if the permissions cannot be changed. Help?

    I used Terminal to change the permissions on the folder in question.  I followed the instructions in this article:
    iTunes: Missing folder or incorrect permissions may prevent authorization
    In my case, the folder was there, so I needed the command to change permissions on the folder, not to create one.   I was hesitant to use Terminal b/c I know that if I made an error I could wipe out my hard drive or render my computer unusable.  So to be SURE I didn't make an error, I carefully copied the command from that page and *pasted* it into Terminal.  Also, before I could do anything in Terminal, I had to go change my admin password (it had been a blank password before and that's not acceptable for making changes in Terminal).  I was just super careful when entering my password or doing anything else while Terminal was open (making sure I didn't accidently hit the spacebar or another key, etc.)  And it fixed the problem right away.
    What was confusing for me was that the iTunes error message said to change permissions in the FINDER, which is what I was trying to do.  It didn't mention Terminal.  What would really be helpful is if Apple included a link to a page like this in their error message.

Maybe you are looking for

  • Vpn-asa 5505 - connects fine, can't use resources

    Using Remote Client VPN to access internal Lan behind an ASA 5505 device.  The connection is working fine. But once I connect, I can't access any computer shared folders etc.   The only thing I can do is access the ASA 5505 through the ASDM 7.1    I

  • FTP sender adapter archives empty files

    Hi. I have a strange problem with the ftp sender adapter. I receive my file without problems, and the scenario works as it should. The problem is with the archiving of my processed file. It writes the file fine to the path specified, but it is empty

  • Problem with JCS Caching

    Hi, I am using JCS for Disk Based Caching. I don't want to use memory cache. So I set the configuration like this: ##### Default Region Configuration jcs.default=DC jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.defaul

  • Can't establish audio or video chat since about a week ago

    Date/Time: 2009-08-19 22:21:51.533 -0400 OS Version: 10.5.8 (Build 9L30) Report Version: 4 iChat Connection Log: 2009-08-19 22:21:22 -0400: AVChat started with ID 3165155967. 2009-08-19 22:21:22 -0400: [email protected]: State change from AVChatNoState to

  • What is the Exceptions in function module

    Hi, wt is the exceptions in function module? can anyone tell me? Thanks swathi