Add the character from of a family of fonts

Hello

There are a few examples available on the evolution of the existing styles etc. quites, but is possible to add extend script if they are not yet added?

Example:

I feel a certain framework of documents by using for example [symbol] as police. Talked normally all channels in my file that use the symbol should have character symtag label, however, for some, it is absent and which is causing issues when structuring my documents. symtag is just a fictional name for a charactertag in my catalog.

So what I want to do is the following:

(1) open document

(2) review the document and for each character using symbol such as a police, check if it is to have the label of character symtag, otherwise add it.

(3) save and close

(1 and 3) are quite easy (well, kind of... off), but I can't find anything on how to do 2) work, I'm not even sure it's possible with extendscript start with.

If she can keep things simple, it's always a unique character that uses the fonts in question.

Thanks in advance for anything that can help me get started!

A small point, but you don't need this:

doc.TextSelection = textRange;

This has been used so that you could see each portion of text highlighted while you were testing on a single paragraph, but it is not necessary in the completed script.

Also an old man scolding you for your approach. I had my original code set up to work on the paragraph containing the insertion point. This is a useful approach because you can test and troubleshoot issues on a single paragraph. Then, once everything works on this paragraph, you can expand the script to work on several paragraphs, documents, etc.. But you went ahead and expanded the script until you got it working on the single paragraph. Therefore, it is difficult to know exactly where the problem is. So, at the risk of being tedious, back on the original code and a paragraph that contains the insertion point. I have slightly modified the code and put it in a function.

#target framemaker

var doc = app.ActiveDoc;
var pgf = doc.TextSelection.beg.obj;
cleanPgf (pgf, doc);

function cleanPgf (pgf, doc) {

    var textList = pgf.GetText (Constants.FTI_CharPropsChange);
    var fontName;
    var begOffset = 0, endOffset = 0, textRange;

    for (var i = 0; i < textList.length; i += 1) {
        endOffset = textList[i].offset;
        if (endOffset  > begOffset) {
            textRange = new TextRange(new TextLoc (pgf, begOffset), new TextLoc (pgf, endOffset));
            fontName = (doc.GetTextPropVal(textRange.beg, Constants.FP_FontPlatformName).propVal.sval);
            if (/symbol/i.test (fontName) === true) {
                alert (fontName);
            }
            begOffset = endOffset;
        }
    }
    textRange = new TextRange(new TextLoc (pgf, begOffset), new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET));
    fontName = (doc.GetTextPropVal(textRange.beg, Constants.FP_FontPlatformName).propVal.sval);
    if (/symbol/i.test (fontName) === true) {
        alert (fontName);
    }
}

When you run this in a paragraph containing the symbol, you should see the alert displays the name of the police. You can replace the alert lines with calls to another function:

function applyCharFmt (textRange, charFmtName, doc) {

    var charFmt = doc.GetNamedCharFmt (charFmtName);
    if (charFmt.ObjectValid()) {
        doc.SetTextProps (textRange, charFmt.GetProps());
    }

}

The problem in your code has this line:

props = doc.GetProps(CharFmtId);

that should have been:

props = CharFmtId.GetProps();

I use a slightly different syntax with the same result. Once get you it working on a single paragraph, you can extend it safely to work on all paragraphs in the document.

-Rick

Tags: Adobe FrameMaker

Similar Questions

  • REPLACING THE CHARACTER FROM THE RIGHT.

    Hey everybody,

    The replace() function replaces a character "." from the left by default.

    var txt:String = "2.5.";


    If (txt.indexOf(".") == 1) / / aid (txt.lastIndexOf(".") == 1) does nothing.

    {

    txt = txt.replace(".","");

    trace (txt); 25.

    }

    There must be a simple method to replace "." from the right so that the vectorised result is "2.5".

    If the point is always the last tank:

    txt = txt.replace (/ \. $/, "");

  • Add the space from one partition to the other

    I have three partitions on one external drive.

    I have reduced the space on a partition and would like to add that extra space for another partition.

    Is this possible?

    No delete and re-create the partition immediately below you shrank.

    (139113)

  • Add the space from D drive to C

    I have 8 GB on my d drive, & I would like to add that my disk space c, how do I do

    Hi DJ King,.

    I think it is always best to leave the disk d (recovery Partition) only. It is there, while in the case of a catastrophic failure, you can restore your system. In this case, a system restore is not possible.

    Matt Hudson
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • VCAC Orchestrator - runtime error 'add the IaaS from vCAC host host '.

    I try to run the "add host a host vCAC IaaS" and the following error below. I tried all the users of [email protected] for the service account Admin that I used to install IaaS. Someone at - it captures the good 'authentication user name"screen, complete a qualified URL for the"URL of the host"and the"domain for NTLM authentication?

    Exception:

    vcacerror.jpg

    to shoot bad security issue we take; We checked the IaaS box security event logs and saw requests for authentication has failed. We were able to determine that the domain entry that we use "ad.ufl.edu" did not work. We ended up having to use one of the of the 'UFAD' domain alias instead. The ID on the security control logs on the box of IaaS and see if you can find the auth error failed in there to see if that gives you any useful information. I think that we have also checked model Web logs Manager \Server\Model Manager Web\Logs in the box of IaaS, but they did not really help in our case.

  • How to remove the character from new line at the beginning of the attachment?

    Hi all

    I tried to attach a .dat file that is generated to an external source and send it as an attachment by e-mail with UTL_SMTP, all things work, but the .dat file that is attached in email contains a new line that is Chr (10) on the start line and the content of the file is written to the second line from. This is a part of the code that deals with reading/writing of the attachment of mail to send.

    Someone can help me on this point, is something to be changed in this code?



    UTL_SMTP.write_data (c,
    'Object ' | ': ' || P_SUBJECT | UTL_TCP. CRLF);
    UTL_SMTP.write_data (c,
    "MIME-Version: 1.0 ' |" UTL_TCP. CRLF. -Use the MIME e-mail standard
    ' Content-Type: multipart/mixed;' | UTL_TCP. CRLF.
    ""boundary ="- SECBOUND" ' | UTL_TCP. CRLF.
    UTL_TCP. CRLF);
    UTL_SMTP.write_data (c,
    '- SECBOUND' | UTL_TCP. CRLF.
    ' Content-Type: text/plain; "|| UTL_TCP. CRLF.
    ' Content-Transfer_Encoding: 7 bit' | UTL_TCP. CRLF.
    UTL_TCP. CRLF);
    UTL_SMTP.write_data (c, UTL_TCP.crlf | l_text);
    UTL_SMTP.write_data (c, UTL_TCP.crlf);
    UTL_SMTP.write_data (c, UTL_TCP.crlf);
    -----
    UTL_SMTP.write_data (c,
    '- SECBOUND' | UTL_TCP. CRLF.
    ' Content-Type: text/plain; "|| UTL_TCP. CRLF.
    "name="/inetpub/wwwroot/Novation_Merge/FS_Extract.dat"' |"
    UTL_TCP. CRLF.

    ' Content-Transfer_Encoding: 8 bit' | UTL_TCP. CRLF.
    ' Content-Disposition: attachment;' | UTL_TCP. CRLF. "filename =" ' | p_description |
    TO_CHAR (SYSDATE, 'DD-MON-YYYY') | ".dat" ' | "
    UTL_TCP. CRLF. UTL_TCP. CRLF. UTL_TCP. CRLF);


    --------------------------------------------------------------------------------------

    BEGIN

    l_filehandle: = UTL_FILE.fopen ("c:\temp",
    "FS_Extract.dat,"
    « r »,
    32767);
    LOOP
    UTL_FILE. GET_LINE (l_filehandle, l_buffer, 32767);

    UTL_SMTP.write_data (c, l_buffer |) UTL_TCP. CRLF);

    END LOOP;
    EXCEPTION
    WHILE OTHERS THEN
    NULL;
    END;

    UTL_FILE.fclose (l_filehandle);



    UTL_SMTP.write_data (c, '- SECBOUND-');
    -----
    UTL_SMTP.close_data (c);
    UTL_SMTP. Quit (c);
    EXCEPTION
    WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
    BEGIN
    UTL_SMTP. Quit (c);
    EXCEPTION
    WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
    NULL;
    -When the SMTP server is down or unavailable, we do not have
    -a connection to the server. Triggers the call to quit one
    -except that we cannot ignore.
    END;
    RAISE_APPLICATION_ERROR (-20000,
    "Failed to send messages because of the following error: ' |"
    SQLERRM);
    END;



    Thank you

    Amol-

    I remember correctly, a single empty line serves as a separator between the header Mime and Mime body.

    Copy the following code...

    UTL_SMTP.write_data(c,
      '-------SECBOUND' || UTL_TCP.crlf ||
      'Content-Type: text/plain;' || UTL_TCP.crlf ||
      ' name="/inetpub/wwwroot/Novation_Merge/FS_Extract.dat"' ||
      UTL_TCP.crlf ||
      'Content-Transfer_Encoding: 8bit' || UTL_TCP.crlf ||
      'Content-Disposition: attachment;' ||UTL_TCP.crlf || ' filename="' || p_description ||
      TO_CHAR(SYSDATE, 'DD-MON-YYYY') || '.dat"' ||
      UTL_TCP.crlf || UTL_TCP.crlf ||UTL_TCP.crlf);  
    

    .. generates 2 blank lines after the Mime header.

    Delete the last CRLF and see if this fits the Bill.

  • Cannot add the song from the cd or ipod to a slideshow, asserts its copyright

    Help

    I am running vista, when I try to add a song to my ipod or in a slide show cd, told me impossible added that it is copyright? What should I do

    You do nothing. He has protected and protected.

  • Cannot add or subtract from the choice of backup discs

    I can't find how to add or subtract from the disks to use for storing upOne of my disks (3) is complete and I want to use new selecta. the preferences window is not resized

    IN aid, he said:
    «If you already set up Time Machine, your backup disks are listed, and information on each disc of the backup is displayed.» To select, add, or remove backup disks, click Select Disk or add or remove the backup disc. »

    I don't see this option in preferences:

    Simon,

    Scroll down in the window pane to display the add/remove disk backup option:

  • I can't install the modules from the official site of mozilla Add-ons. I click 'Add to firefox' and nothing happens! Help!

    I can't install the modules from the official site of mozilla Add-ons. I click 'Add to firefox' and nothing happens!

    Hello

    Please check if a green icon is added to the left of the icon in the Web site address bar after clicking on Add to Firefox. If it appears, click it, check the message and select the desired action.

    Another reason could be that the extension could block Javascript or other features of the site.

  • With a binding high-speed small (1.3 MB) and living in a multi storage House, is it a lot to win add a device from the airport to the BT router?

    We have a high link flow modest (1 to 3 Mbit/s) and a several-storey house.

    My iMac will work faster Safari if I add a device from the airport to the BT router?

    My iMac will work faster Safari if I add a device from the airport to the BT router?

    No, because the speed of your Internet connection is controlled by your provider, BT, if you need a faster Internet connection, you will need to talk to BT one faster... and more expensive... plan connection.

  • Is it possible I can make a new patent account and add the account of the child as a member of the family?

    How can I add a new parent account on behalf of the child on our Xbox. The original parent account no longer works. And we have not been able to recover the account. Is it possible I can make a new patent account and add the account of the child as a member of the family?

    Scroll down to the bottom of the page, and then select an Option to contact Xbox Support

    http://support.Xbox.com/en-us/contact-us#0:1:2

  • I can't add a component from the Add Remove program window as says could not initialize winxp

    I can't add a component from the Add Remove program window as says could not initialize winxp

    My victory is xp professional ver 2002 service pack 3

    It's usually easy to fix, but if you removed all the dll and inf files, you can have a bunch of other problems that you have not yet discovered.

    If you mean when you try to use Add/Remove Windows components you see a message like this:

    Install was not able to load the master file.
    The application could not be initialized.

    This happens because this file is missing:

    c:\windows\inf\sysoc.inf

    There is no copy backup of this file on your system and run the System File Checker will not replace the missing file (sorry, that Microsoft committed Support Engineer 'experts').

    You will need to get a real copy of your XP bootable installation CD or from a reliable source.

    There's a copy on my SkyDrive, you can download - here's how:

    I downloaded a copy of XP Pro SP3 file you need on my SkyDrive (everyone has a SkyDrive for file sharing).

    You can download it and when you do, put a copy of the file in this folder (assuming that Windows is installed on your C drive):

    c:\Windows\Inf

    Here is the link to my SkyDrive and you can get the file you need here:

    https://SkyDrive.live.com/?CID=6a7e789cab1d6f39&ID=6A7E789CAB1D6F39! 311

    When you see the files available for download, you can not see the file extension (.exe, .dll, .cpl, .sys, .zip, etc.), but when download you them they will have the right extension.

    When you download the file (especially if you use Internet Explorer), when you get a chance to save the file, your browser is unable to save the file with an extension (by example, .exe, .dll, .cpl, .sys, .zip, etc) then you will need to manually add the extension appropriate to the file when you download the file before you save it.

    You can download the file without the extension, and then rename the file to add the appropriate extension.  You do not want to use a file named sysoc when the name of the file should really be called sysoc.inf (if the downloaded file has no extension, you will need to change the name of the file to add the appropriate extension to make it work.

    You must then copy and paste the downloaded folder appropriate on your system.

  • WMP 11 crashes when you add media to the library from an external HARD drive

    WMP 11 problem!

    I have win XP and current run WMP 11, I try to add data to my library on an external HARD drive, the player begins to add and then crashes... I tried rebulding, clear memory cache and re - install the software... I also tried the HARD drive on another machine, and it worked fine... solutions?

    Hello

    ·         There the latest changes on the computer before the show?

    ·         Have you tried to connect the drive to a different USB port and check?

    Method 1:

    I suggest you try to install the hotfix from the link given and check if it helps:

    FIX: Windows Media Player 11 may stop responding when you transfer media to a device that uses the Media Transfer Protocol and then you cancel the transfer process

    http://support.Microsoft.com/kb/935552

    Method 2:

    Follow the steps in troubleshooting this article and check if that helps.

    You cannot view, add, or delete items in the library of Windows Media Player 11

    http://support.Microsoft.com/kb/925718

  • I can't remove intuit the program from my computer in Add Remove programes and even hd C

    I installed the program Intuit of a disk that has been altered, but there no Reome when I tried to remove it through Add Remove program from Control Panel

    Thank you

    Hi PAQpia,
     
    -You receive an error message trying to uninstall the program?
     
    Use the tool to uninstall Quicken to uninstall the progr intuit.
     
    Visit the following link to download the same:
  • Add a photo from the album a song?

    Is it possible to add a photo from the album a song at the computer so when it's a game on a phone (a Nokia C3-00), the image will be visible next to the title?

    The link below is an example. I got the song fromm someone else and I added nothing to it, just put it in the phone. But once played, a picture next to the title of the song (not the image of the album, maybe the image of the site where to get this song).
    http://img20.imageshack.us/img20/1428/img8524h.jpg

    Hi knguyen7,

    Welcome to the Microsoft community where you can find all the answers related to windows!

    According to the description, it looks like you want to add a photo from the album a song.

    I will certainly help you with this issue.

    "Visit this link if you want to add to the album by using Windows Media Player, refer to" ""manually add album art of your choice ".

    http://Windows.Microsoft.com/en-us/Windows7/add-or-change-album-art-in-Windows-Media-Player

    Hope this information helps. Answer us queries windows and we will be happy to help.

Maybe you are looking for