How to add a character style in the active document

Hi experts

How to create a character style in the active document.

How to make the script work.

Thank you

Respect of

John

var myCharacterStyle;

myDocument var = app.activeDocument;

var myCharacterStyle = myDocument.characterStyles.add({name:"c"});)

myCharacterStyle.strikeThru = true;

myCharacterStyle.strokeColor = 'Black ';

myCharacterStyle.add)

There is not much to say about your code. Only the last line would cause a problem. A possible hiccup is also on the fact that the style may already exist when you want to add.

myDocument var = app.activeDocument;

var myCharacterStyle = myDocument.characterStyles.item ('c');

! myCharacterStyle.isValid & myCharacterStyle = myDocument.characterStyles.add({name:"c"});)

myCharacterStyle.strikeThru = true;

myCharacterStyle.strokeColor = 'Black ';

Tags: InDesign

Similar Questions

  • Cannot add an object style to the library directly

    I can't add an object style from by dragging a style object to an indesign Library palette. Is this normal?

    That is to say, to add an object style to the library, I have to drag an object that has this particular style of my my indesign library. Right?

    Yes, it's true. Failed to add to a library of object Styles, but adding an object.

    Add any object adds an object Style, Object Styles depending on the occasion, used the paragraph and character and the name Layer Styles Styles.

  • How to effectively use character Styles

    Hello, I am fairly new to InDesign, but have extensive experience with FrameMaker. I can't know how better to use character styles to card of identity, because of the difference between her and FM.

    Lets say I have two text styles different bodies that use different fonts or different sizes, each is saved as a paragraph style.

    In Framemaker, when you go into the character Style Editor, for each value you can select the value "such what." So if I want to do a character style "BOLD", I leave the police and set size attributes on "like what" and I change only the weight to the "BOLD" attribute.

    Now, I can choose the body text 1 or 2 for the paragraph style body text and if I want to "BOLD" one word, I just highlight the word and select the character style "BOLD". The text is bold, but everything else that is unique for what remains of paragraph style. If ever I need unbold the word, I can just select it and then select No Style in the character Style catalog

    But in the ID, it looks to set the value of each attribute in the character Style Editor. So I would need to create two styles "BOLD" separate, one for each paragraph style, because if I set the font and size, it will pass these values as well as the weight. And if I need to create a separate "BOLD" character style for each paragraph style in which the default font is not bold, what is the advantage of using character styles? Why don't just highlight the text and select the value "BOLD" to the character palette, which then changes the paragraph style just for these words in bold you?

    In InDesign, leaving an empty frame is the equivalent of "as-is." A character style "BOLD" can function as you want; Simply set the Style of font for "BOLD" and leave everything else intact.

  • How to apply a character Style that has already been made in a document model?

    First of all, I would like to thank everyone who helps. I am a complete newbie to the script and appreciate your help.

    I mainly use GREP expressions to search for patterns in a document and apply a character Style that has already been done. This character style did not help script, but just in InDesign when the production and implementation of the model.

    var myDoc = app.activeDocument;
    
    
    //Clear the find/change grep preferences.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    
    //Set the find options.
    app.findChangeGrepOptions.includeFootnotes = false;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    
    //GREP Expression for finding all HEADERS
    app.findGrepPreferences.findWhat = ".+\n";
    
    //Applying formatting changes to put into All Caps, Bold and changing the font size to 12 pt.
    app.changeGrepPreferences.capitalization = Capitalization.allCaps;
    app.changeGrepPreferences.fontStyle = "Bold";
    app.changeGrepPreferences.pointSize = "12";
    myDoc.changeGrep();
    
    //Clear the find/change preferences after the search.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    

    This is how I currently. I will manually define the changes made to the text. The problem is, each model uses a different set of fonts and not all use them "BOLD", for example Sabon can use THIS "BOLD".

    I would like to know how to apply a character Style and tried to look, but nothing seems to work.

    Any help would be appreciated.

    Thank you.

    app.changeGrepPreferences.appliedCharacterStyle = "A";

  • How to add a new language to the language and region of the Panel

    Hello
    Setting preferences in Mac OS X, I could ' t help noticing the huge amount of languages available in the Mac OS X El Capitan. Located in same languages like Klingon, Navajo and Latin - and of course, this looks like a great tribute to the rich diversity of languages in humanity. However, Mac OS X El Capitan still missing a language - my own. How can I add another language to the language and region of the Panel? How Klingon and Latin is?
    Of course, I have this Internet search, but nine out of ten results were some tutorials explaining how to add an EXISTING language to the ones I already have.

    Thank you.

    Rui Valente

    You just 'Add' a language. You would have to edit all applications to create strings of replacement for all menus, dialog messages, buttons, etc., that it doesn't translate from one language to the other. Each application has a list of strings mapped to the display string for each supported language. The localized string replaces the generic string in the user interface element.

    You can try to contact Apple and volunteer to locate the operating system, they would have confidence in you (unlikely) or hire a person to validate your work.

  • How to add white Gaussian noise to the picture of her and her negative?

    How to add white Gaussian noise to the picture of her and her negative?

    Is that what you're trying to accomplish:

    TO:

    Here's the code to do.

    Michel

  • How to add my link (folder) to the side RIGHT of the Start Menu?

    How to add my link (folder) to the side RIGHT of the Start Menu? I mean under my documents my music.

    Do I need a registry change or easy way?

    See my post here.

    Replace "Set Program Access and Defaults" Start Menu XP with trash:
    http://groups.Google.com/group/Microsoft.public.WindowsXP.customize/browse_thread/thread/1479ca45f5598b84/91bef4c26cd81c6b?q=replace+%7B2559A1F7-21D7-11D4-BDAF-00C04F60B9F0%7d
    Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]

  • How to add a second connection of the user with windows 8

    How to add a second connection of the user with windows 8

    Go to the Control Panel, then click on change the Type of account in respect of the accounts of users and parental control.  Beneath the box with user accounts, there should be a link that says add a user account.  Click on that and follow the instructions to set up another user.

  • How to add a time system of the document?

    How to add a time system of the document?

    I tried to edit this script, but probably wrong with the command...

    var f = this.getField ("Today");

    f.Value = util.printd ("mm/dd/yyyy", new Date());

    Change this part of the code:

    util.printd ("mm/dd/yyyy", new Date());

    TO:

    util.printd ("HH: mm", new Date());

  • How to add and edit text in the form created by adobe acrobat 9?

    How to add and edit text in the form created by adobe acrobat 9?

    Actually, that's exactly what you should do, you don't need to create

    all fields again.

    After you have edited the original and create a new static PDF, open the old

    version and use the command replace Pages to insert the new pages

    those in the old file. This will keep all the form fields in tact.

    Tuesday, August 25, 2015 at 10:28, susanna323 [email protected]>

  • How to add an image that fill the browser?

    How to add an image that fills the browser when it is resized? Like this site Freelance Design & photography: cotton - ink.co.uk where the window or the filling of pict cabin browser.

    Thank you

    Hello

    Please, try the following steps.

    1 create a rectangle and make it 100% width by pressing the button width 100%.

    2 give this rectangle at the height of your choice.

    3. fill the image desired in the rectangle using fill option and make 'Center' "scale to fill."

    Please let me know in case you are looking for something else.

    Concerning

    Vivek

  • How to add a data center on the virtual center via VI client server?

    How to add a data center on the virtual center via VI client server?

    I formatted ESX server & ESX Server Update installed keeping the data center on the storage (of many desktop computers)

    Now I have fresh installed a new server of virtual & added the ESX Server, but I'm unable to reattach existing data centers on storage.

    What will be the way to import of existing data on server Center virtual center?

    Help, please...

    Is ' VMware-VMimporter - 2.0.0 - 30557 "is the software through which I can solve my problem?

    You need to browse each data store, go to the folder of the virtual machine, right-click on the *.vmx file and add it to your inventory.

    Andrea

    * If you found this device or any other answer useful please consider awarding points for correct or helpful answers

  • How to add and delete pages in a pdf document?

    How to add and delete pages in a pdf document?

    The easiest way is to use the Page thumbnails Panel.

    But you can also use the Pages pane.

  • How to add to a specific page in one document to another

    How to add to a specific page in another document

    When you add a bookmark, it takes by default the current page and the view (zoom, scrolling). If you want to link to a location in another document, after you have created the bookmark, select it, right-click, then select Properties, then select the Actions tab remove the default action and add a new type of "Go to a page view". When you are prompted with the dialog box "Create go to View", open the other document and go to page set the view (zoom, scrolling) you want and then click on the Set"" button. When you distribute the files, make sure that they retain the same folder structure. This is done much easier if all PDF files are in the same folder.

  • How to print ONLY the active document?

    Whenever I go to file/print program PSE 9 darn all working files sends in the tray of the printer. I searched online for 2 hours, now looking for an answer.

    I enjoy working with several to several files in the 'bin' and prefer to print only the active file, I am currently working on without having to close the "working files" before I can print. How can I print ONLY the active document or file in the location of project? Please help, I upgraded from PSE 3 PES 9 and really like the updated features, but what a pain in the neck by default becomes the best of me.

    Select it in the trash before calling to the top of the print window. If nothing is selected, everything happens in the print window.

Maybe you are looking for

  • Hallo why? When I update ios. When the image has finished error itunes and usb

    Hallo why? When I update ios. When the image has finished error itunes and usb

  • Troubleshooting of fire suppression in multicolumn listbox elements.

    Hi all I'm developing a program to work with an instrument that communicates by RS232. I can connect to the instrument very well and very good control, my problem is when you try to remove data from the MCLB.  Attached is my entire .vi for reference,

  • Run the VI command line in Windows 7

    I try to open a VI and do it run whenever called from the command line.  I am running Windows 7 and LabVIEW 2009. I followed this guide to get me started. First, I marked my VI "run the opening: I therefore call on my command prompt similar program:

  • USB stick not recognized even on other computers

    Hey- A few days ago I plugged in (USB) flash drive of 512 MB on my desktop Dell (Windows Vista), and that bubble "USB device not recognized" come at the bottom of my screen. I tried to put in the other USB ports, ports on different computers and the

  • After system upgrade...

    Hi, today I had update my laptop due to black screen problem... However, now I have the following problem. It won't let me access the C drive, Download files or install programs. And it gives me some error messages from radom. And yes I am the admin