[AS][CS5] Find and replace a missing font

I have an overly complex script that compares the document's fonts missing fonts to the system fonts and makes a best guess. It was written to handle conversion of Multi-ad Creator documents to InDesign. It has worked 100% of the time so far. It needs a LOT of cleaning up and tweaking to make effecient, but that is not the point of my question. Everyday I am sent an InDesign file I have to work with and everyday it will has a missing font. Arial (OTF).
I ran my script thinking it would replace it with Arial (TT). No problem...
Ran it... nothing.
When I use the find dialog in Indesign to search based on the applied font it works, the returned properties in AS contain:
return properties of find text preferences
font:"Arial (OTF)"
Ok, fine so I try...
set properties of find change text options to {case sensitive:false, whole word:false, include footnotes:false, include hidden layers:false, include locked layers for find:true, include locked stories for find:true, include master pages:true}
    set applied font of find text preferences to "Arial (OTF)"
    set applied character style of change text preferences to "Page&Header"
    tell document 1
        set myFoundItems to change text
    end tell
Nothing.
This has pretty much worked on every other font I've tried, so what am I doing wrong here?

All right, back at it....
I've run into even more fonts that it is an issue with. My basic thoughts on this are as follows: When bringing a document from Multi-ad Creator to InDesign the fonts are named in a way that InDesign does not recognize them. The thing is those fonts are really fonts that are on my system. It is simply a matter of rearranging the name of the applied font to match what InDesign would recognize. The thing is InDesign will allow me to use Find/Change to modify the fonts in the document.
Now the fonts I've run across that give me an issue are fonts that do not correspond to any font on my system. I do not have any TrueType fonts, this document I opened today did...
tell application "Adobe InDesign CS5.5"
    set myDocument to active document
    tell myDocument
        set myPage to page 1
        return properties of every font
    end tell   
end tell
 {{font family:"Helvetica (TT)", PostScript name:"Helvetica-Bold", parent:document id 34 of application "Adobe InDesign CS5.5", index:1, name:"Helvetica (TT)     Bold", object reference:font "Helvetica (TT)     Bold" of document id 34 of application "Adobe InDesign CS5.5", status:not available}, {font family:"Helvetica (TT)", PostScript name:"Helvetica", parent:document id 34 of application "Adobe InDesign CS5.5", index:0, name:"Helvetica (TT)     Regular", object reference:font "Helvetica (TT)     Regular" of document id 34 of application "Adobe InDesign CS5.5", status:not available}, {font family:"Times (TT)", PostScript name:"Times-Bold", parent:document id 34 of application "Adobe InDesign CS5.5", index:3, name:"Times (TT)     Bold", object reference:font "Times (TT)     Bold" of document id 34 of application "Adobe InDesign CS5.5", status:not available}, {font family:"Times (TT)", PostScript name:"Times-Roman", parent:document id 34 of application "Adobe InDesign CS5.5", index:0, name:"Times (TT)     Regular", object reference:font "Times (TT)     Regular" of document id 34 of application "Adobe InDesign CS5.5", status:not available}}
Ok, so let me try this (commented out are the different ways I've tried):
tell application "Adobe InDesign CS5.5"
    set myDocument to active document
    tell myDocument
        set myPage to page 1
          --return properties of "Helvetica (TT)" --"Helvetica (TT)     Bold"
        return properties of font "Helvetica (TT)" -- "Helvetica (TT)   Bold"
        set myDocumentFonts to name of every font
    end tell
end tell
Adobe InDesign CS5.5 got an error: Unable to retrieve the font's UID from its name.
I was able to get the properties of the font using:
return properties of every font whose PostScript name is "Helvetica-Bold"{font family:"Helvetica (TT)", PostScript name:"Helvetica-Bold", parent:document id 34 of application "Adobe InDesign CS5.5", index:1, name:"Helvetica (TT)     Bold", object reference:font "Helvetica (TT)     Bold" of document id 34 of application "Adobe InDesign CS5.5", status:not available}
Now I thought of trying the following:
tell application "Adobe InDesign CS5.5"
    set find text preferences to nothing
    set change text preferences to nothing
    --Set the find options.
    set properties of find change text options to {case sensitive:false, whole word:false, include footnotes:false, include hidden layers:false, include locked layers for find:true, include locked stories for find:true, include master pages:true}
    set applied font of find text preferences to every font whose PostScript name is "Helvetica-Bold"
    set applied font of change text preferences to "Helvetica"
    tell document 1
        set myFoundItems to change text
    end tell
end tell
Now this does result in something, the find of the Find/Change dialog is looking for Helvetica + Bold. The only problem with that is it isn't looking for the TT font.
tell application "Adobe InDesign CS5.5"
    set myDocument to active document
    tell myDocument
        set myfind to properties of every font whose PostScript name is "Helvetica-Bold"
    end tell
    set find text preferences to nothing
    set change text preferences to nothing
    --Set the find options.
    set properties of find change text options to {case sensitive:false, whole word:false, include footnotes:false, include hidden layers:false, include locked layers for find:true, include locked stories for find:true, include master pages:true}
    set applied font of find text preferences to name of myfind
    set applied font of change text preferences to "Helvetica"
    tell document 1
        set myFoundItems to change text
    end tell
end tell
And nothing happens.. other than it trying to search for Helvetica + Bold
I'll try some other ideas later when I have more time.

Similar Messages

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • Multi File Find and Replace FAR missing from tools

    I have RoboHelp x5.0.2 and I have always used Find and
    Replace at my previous employer. I have started with a new company
    and the RoboHelp FAR is missing from Tools. I know you can Add a
    tool if you know the path, but I have no idea where to look.
    Some background:
    We use Source Safe (VSS) to check our files in and out.
    I have verified that all of the files are NOT read-only.
    HELP!!!!

    Maybe you are mixing up something. RoboHelp includes a tool
    named Multi-File Find and Replace. This should indeed be situated
    on the Tools pane.
    There exists a tool called FAR, which, among other things,
    offers a similar functionality. FAR is shareware and
    not included in RoboHelp.
    Greetings
    ---Dirk Bock

  • Find and Replace HTM editor font

    After a "Find" action, there opens a new HTM edit window which uses a non fixed pitch font. Where can I can change this font style?

    I am not aware of any way to do this.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • I'm trying to replace a missing font and apparently it's a graphic.  It's not letting me replace with another font and click change.  I can't export until it's fixed and I need to fix / bypass as soon as possible.

    I'm trying to replace a missing font and apparently it's a graphic.  It's not letting me replace with another font and click change.  I can't export until it's fixed and I need to fix / bypass as soon as possible.

    Go find the graphic in question, and open it in its native program. The problem will have to be fixed there.

  • Is design view missing from RoboHelp's new Find and Replace editor?

    I just started using RoboHelp 10 and was excited about the new Find and Replace feature. However, it seems to force the user to edit in the HTML editor (which is very difficult when the topic has tables). Am I missing some preference setting?
    The only workaround seems to be to to find a topic and then track it down in the Project Manager list and open it in the normal fashion.
    Thanks.
    Carol

    Find and Replace in Files (as opposed to a single topic) has always been at HTML level.
    If you do use this updated feature, do not use the Contains field unless you want to kiss your project goodbye. See Using Rh10 on my site.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Dreamweaver CS5 out of memory when trying to find and replace

    Please help. I am running Dreamweaver CS5 on a windows 7 os. This has happened in previous versions as well. This is a new computer and a new install. There are no memory shortages on this machine.
    I go to search for something, and select either folder or files in current site. It starts, then flashes the "out of memory" dialog box and stops the search. I have to force quit to leave the program.Over and over. Find and replace of a site or folder is a crucial function I use this program for!
    Thanks for any help
    S

    How big are the combined files in your Local Site folder?
    My guess is that you have something really colossal such as server log files or something else that are causing DW to choke and freeze during its Find / Replace scan.
    If you can identify the really huge files/folders in your site folder, you could use 'cloaking' to exclude them from DW operations.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Find and Replace Font Colors in Multiple Text Boxes

    Hello,
    I have Illustrator version 15
    I made many text boxes with multiple colors, red and black on each letter. I was wondering if there is a find and replace tool for multiple text boxes. I want to change the reds to black and the blacks to light grey. I tried clicking on change swatch color but it only worked for the letter I had selected, even with the global option selected. I then when to select -> Same -> Color Stroke but it just selected each text box on the page....Is there anyway to do this?
    Jordan

    Not exactly a find and replace but you can do it.
    Select the text frames yu want to change the colors using the shift key to click select the frames.
    Then go to Edit>Edit Color>Recolor Art
    You wll see a dialog with red and black bars along side two shorter bars click the shorter bars to select a New Color a color picker will appear you can use the swatches or the color mixer.
    There is a live preview /so you will see the change in case you want to pick a different gray, of course you can always go back to the recolor art dialog.
    I am afraid you manually have to select text frames with multiple colors in order to accomplish what you want but the method above I believe is the only want to change the colors.
    This video shows how the dialog works but pretend the one frame I did not select is another color.
    http://www.wadezimmerman.com/videos/RecolorText.mov

  • VBA Word Find and Replace characters but excluding certain characters

    I am trying to write VBA code in Word that I will eventually run from a VBA Excel module. The aim of the project is to find specific strings in the open Word document that have length of either one or two characters and are of a certain format, and replace
    them with other strings in the same format. This is to do with transposing (i.e. changing the musical key) of chord symbols in a songsheet in Word. The Find and Replace strings are contained in ranges in an Excel workbook, which is why I want to eventually
    run the code from Excel. I'm much more experienced in writing VBA code in Excel than in Word, and I'm fairly confident with transferring the 'Word VBA' code into an Excel module.
    At the moment I'm trying out code entirely in Word, and I've come across a stumbling block. For example, I want it to Find "A" and replace with "B",
    BUT only if the "A" is NOT followed by "#" (sharp) or "b" (flat).
    Here is the code I've got in Word VBA, which I obtained by editing code produced by the recorder:
    Sub F_R()
    'Find text must have specific font
    With Selection.Find.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Replacement text must have specific font
    With Selection.Find.Replacement.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Find & Replace strings
    With Selection.Find
    .Text = "A" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Replacement.Text = "B" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = True
    .MatchWholeWord = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub
    For the Find & Replace section I want to do something like:
    With Selection.Find
    .Text = "A"
    .Text <> "A#"
    .Text <> "Ab"
    .Replacement.Text = "B"
    End With
    - but this produces a syntax error, presumably because you can have only one .Text line (or it won't accept <>?)
    I tried adopting the way of excluding chars when using the Like operator, and while it compiles, it will not replace
    any "A":
    With Selection.Find
    .Text = "A[!b#]"
    .Replacement.Text = "B"
    End With
    I suspect that I'm going to have to change tack completely in the way I'm doing this. Do you have any suggestions, please?
    The chord names/symbols are preceded/succeeded by either spaces or paragraph returns and can look like these, for example (all Font Bold and Underlined words only):
    C<sup>7</sup>
    Dm<sup>7</sup>
    Eb<sup>-5</sup>
    Bb<sup>+11</sup>
    F#m<sup>7</sup>
    i.e. [ABCDEFG][b # | optional][m |optional][- + | superscript, optional][2 3
    5 6 7 9 11 13 | superscript, optional]
    The crux of my problem is that the note A should be treated as entirely distinct from Ab or A# (and similar for other flattened/sharpened notes).
    Sorry for long post.

    Hi Ian,
    It is not easy to find Microsoft forums. However this forum is for the Visual Studio Net version. 
    Try this forum for VBA.
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    Success
    Cor

  • Batch Edit Multiple HTML files | Find and Replace

    Hi,
    I would like to use Automator to automate (I know that sounds redundant) the following process.
    1. Take a group of html files
    2. Open each file so it can find and replace the script of any image folders
    Example:
    Change: img src="home_files/photo.jpg" to img src="images/photo.jpg"
    3. Save & Close each file
    I assume this this would have to be done in either AppleScript or Cocoa.
    Any help would be greatly appreciated.
    Thanks in advance.

    you most definitely don't need Cocoa for something like that. if all you need is a straightforward search and replace in a bunch of html files you can easily do this with a shell script. If you need some more involved search and replace you have to explain what it is exactly that you want.
    to automate direct search and replace you can do something along the following lines in automator
    1. get selected finder items (this will select your html files)
    2. run shell script action with input passed as arguments
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    for f in "$@"
    do
    fl=`echo "$f"`
    sed 's%home_files/photo.jpg%images/photo.jpg%g' $f > /users/$USER/.tmp.txt
    cat /users/$USER/.tmp.txt > "$fl"
    done
    rm /users/$USER/.tmp.txt</pre>

  • Find and Replace simple action crashes Illustrator CC

    I am now trying Creative Cloud and I came with this bug. When I use a simple action to find and replace a text string in my file it will crash the Illustrator.
    My actions is pretty simple:
    Find > "aa" (I do have to check all the options to work)
    Find and Replace > "aa" to "2014.01.29"
    This action works well if I use it once by the Edit menu, but if I close the Illustrator and reopen, it'll not work again and will crash the software.
    Everyday I do update my action to actual date, so the action will work normally but sometimes I do have to close the app and I have to make the action again and again everytime.
    This was a problem already in CS5, last version that I used.
    I'm using Windows 8.

    Msot likely this isthe problem of the action playing back to fast.
    Actions Flyout >> playback options > set to altast 1 second
    You will need to change this setting each time you resart illustrator

  • How do you find and replace "within selected text" in a textedit document (version 1.8, mountain lion)

    In the textedit version on Snow leopard it was possible to search and replace within a peice of selected text only i.e. not the entire file. This was a very useful feature because you could select a paragraph and replace all occurences of word1 with word2 within that paragraph only! This feature appears to be missing from the mountain lion version of textedit (version 1.8). Or can anyone tell me how to do it ... ?

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • How can i find and replace xml tags?

    Hi, i am using xml in my workflow and want to be able to remove certain tags if they contain particular text.
    here is an example of my xml structure…
    <entry>
        <name>DEFAULT</name>
        <tel>DEFAULT</tel>
        <address>DEFAULT</address>
    </entry>
    I am using this initial structure to set the paragraph styles to be followed when the xml data is imported.
    This leaves DEFAULT in place wherever an entry doesn't have any content for that field.
    I want to be able to import my XML then run a script that removes any tags that include DEFAULT, - I need the entire xml tag to be removed not just the text, if i do a normal find and replace it will only remove the text not the tags which is causing problems with styling. I also want to remove the end of para/return (^p) that i've placed at the end of the line. So it would be the same as opening up story editor and removing the content + tags + hard return in there, but i want to automate the process…
    So i think this is what i need to search for in each case
    "<name>DEFAULT</name>^p"
    and i want to replace it with nothing ""
    Can this be done through scripting (ideally javascript)?
    I have a little knowledge of javascript but am not sure how to search and target that kind of string in indesign...
    using indesign cs5
    many thanks

    Hi,
    Script should do it in two steps:
    1. find all occurences of i.e. ">DEFAULT<"
    2. remove whole paragraph which is a found_text's container.
    For example this way -JS - (a textFrame filled with your text should be selected) :
    var mStory = app.selection[0].parentStory;
    app.findTextPreferences =  null;
    app.findTextPreferences.findWhat = ">DEFAULT<";
    var myF = mStory.findText();
    var count = myF.length;
    while (count--)
         myF[count].paragraphs[0].remove();
    rgds

  • How do i find or replace the missing disk image for my HD

    How do i find or replace the missing disk image? for my HD ........as it is missing when i try to back up with time machine, 
    i asked for assistance the other day with time machine
    now i have worked out this is the reason i can not back up with TM, due to no disk image in my portable hard drive
    I saw a post on youtube where it explains you can copy a your HD disk imag from your time machine back ups enabeling, time machine to back up
    But i can not find where the TM Back up driver is situated in my TM Back up's
    Some advice would be greatly appreceate   as i am rather new to Mackintosh 
    Thank you
    Aiden

    Hi again.
    Just re-reading your first post, I wonder if you're confusing a disk image backup with Time Machine?
    It's certainly possible to create a disc image of your Macintosh HD and copy it to an external drive.
    However, as a backup that method has a drawback; you can't boot from a disc image directly. It needs to be mounted on a bootable system before it can be used. So it's not really much use if the internal HD fails, at least as far as allowing you to carry on working while the repair is carried out.
    Much better (and simpler) is to clone the whole drive to the external using CarbonCopyCloner or SuperDuper (there are plenty of others, but those appear to be the most popular).
    That will give you a bootable backup which can be kept up to date by incremental backups using the same applications.
    In the event of total internal HD failure all you need to do is replace the drive then boot from the clone and reverse clone to the internal to get up and running again.
    Many of us use both a bootable clone and Time Machine (on seperate drives) as each has it's different uses.

  • Dreamweaver CS6 "Find and Replace" not working

    Since I've started working in DW CS6 I've noticed that the Find and Replace feature isn't working completely.
    E.g. If I select a block of code, then open Find and Replace, tell it to find "<br />" and replace it with "</li>" it only replaces the first instance. The rest of the <br />'s are still <br />'s.
    Is this happening to anyone else? I may have to switch back to CS5.

    bracdiver wrote:
    ** ANSWER/Workaround
    Change the selection in the 'Search:' dropdown from the default 'Source:'  to 'Text' or 'Text (Advanced)' and you will get the desired result.
    bracdiver, your post may be useful in some examples, like the ones I posted above. However, this does not work in my intended example below (which is source code specific), where the actual source code needs to be replaced:
    Sample
         <p>These are true or false questions. Place your answer on the blank under each question.</p>
    <ol>
        <li>There are twelve in a baker's dozen</li>
        <li>35% of people are going to school.</li>
        <li>There are seven books in the Harry Potter series.</li>
        <li>The longest running play is "Les Miserables"</li>
        <li>There is no blank under this question. <i>Answer beside this question instead.</i></li>
    </ol>
    Using these options
    Find in: Selected Text (first four list items)
    Search: Source code:
    Find: </li>
    Replace: <br />___________________</li>
    Options enabled: Match case
    Desired output:
    <p>These are true or false questions. Place your answer on the blank under each question.</p>
    <ol>
        <li>There are twelve in a baker's dozen<br />___________________</li>
        <li>35% of people are going to school.<br />___________________</li>
        <li>There are seven books in the Harry Potter series.<br />___________________</li>
        <li>The longest running play is "Les Miserables"<br />___________________</li>
        <li>There is no blank under this question. <i>Answer beside this question instead.</i></li>
    </ol>
    CS6 DW output:
    <p>These are true or false questions. Place your answer on the blank under each question.</p>
    <ol>
        <li>There are twelve in a baker's dozen<br />___________________</li>
        <li>35% of people are going to school.</li>
        <li>There are seven books in the Harry Potter series.</li>
        <li>The longest running play is "Les Miserables"</li>
        <li>There is no blank under this question. <i>Answer beside this question instead.</i></li>
    </ol>
    Using your workaround (with 'Inside Tag' option set to li), this will not work as does not change any text at all.

Maybe you are looking for

  • Dynamically building web content using XML file(s)

    Hello All! I was recently tasked with a project to design a monitoring web application for our "in-house" built web applications. There is a certain set of modules and parameters that we need to monitor: GSLB --> Web Tier --> App Tier --> Database. A

  • How to remove existing infoobject from infosource?

    I was added one infoobject Z01 into DSO ZDSO01 and Infosource 2LIS_08TRTLP , and did mapping in the transfer rule. Now I removed Z01 from DSO ZDSO01, but I'm unable to remove Z01 from infosource. System show me error message like: The InfoObject ZO01

  • I accidentally clicked "do not ask me this again" about forcing an extension change when downloading. How do i get firefox to ask me this again?

    I was using download helper and a box usually pops up that asks me if i want to force an extension change. I clicked the wrong box and then clicked "do not ask me this again". I would like to get the box back so i can change the setting.

  • Multi pages

    Hi what is the best way to handle multi panes inside border pane ? I am using border pane , at the top I have some push buttons I need to change the panes in the left , center or right areas based on the push button pressed at the top the panes at le

  • JTable column with multiple components

    Hi, I have to use a List and a comobobox in a single column. How can i achieve this. It will be a great help if somebody can provide me some sample code. I know how to set a custom component for the entire column or entire row. So please provide me t