Scripting inline styles to text

Hello,
I am having trouble getting my head around the indesign DOM in regards to programmatically (javascript) applying text styles inline and on the fly. By that I mean the text items I want formatted don't exist in the current document at the moment the script is executed. To give an example
In the current document there is only one textframe called "frame1"
In the script...
var str1 = "$";
var str2 = "19";
var st3 = "95";
The result I wish to see in the text "frame1" (if written in html) is <sup>$</sup>19<sup>95</sup> All on the one line
I found this post http://forums.adobe.com/message/4547401 Solution 2 maybe how to do it,
myTextFrame = app.selection[0]; // is this necessary? can i use textFrames.itemByName(name)?
firstInsertionPoint = myTextFrame.insertionPoints[-1].index;
myTextFrame.contents += "New Text";
myAddedText = myTextFrame.characters.itemByRange(myTextFrame.insertionPoints[firstInsertionPoint],
myTextFrame.insertionPoints[-1]);
// i assume i would apply position.superscript here
myAddedText.appliedFont = app.fonts.itemByName("Trajan Pro"); // etc.
but I do not understand exactly what it's doing especially with the insertion points.  I have coded Visual Studio Projects for Office Word and the syntax looks kind of familiar but I find indesign documentation too spartan to help me. Grant Gamble's book was very helpful until I wanted to go down this weird path.
I am using indesign 5.5 and ESTK
Thank you in advance
Anthony
Hi again,
I tried playing with the above source post solution 1, the move method of the paragraph collection has it's parameter list around the wrong way at least according to indesign 5.5. Has there been a change between versions? Is this the right way of going about this?
thanks again

Hi Peter,
Thanks for the head up on
   found[i].characters[-2].position = Position.superscript;
   found[i].characters[-1].position = Position.superscript;
i didn't know you could do such things
As I said, the price is coming in  (web service) as two variables. There is a reason for this. There is some type setting done on the two variables before they are added to the service. For example, size of font. I can calculate the length of the dollar component IF there is one. It maybe zero eg 99 cents. Knowing the length of dollars it can loop appending "\d" 's at the end of each iteration and use this regex in the grep. Works perfectly. Though with above code frag you provided i can do it another way. It's good to have choices!
In a all I have written a web app that acts as a front end for indesign "documents/objects/templates/empty square holes i can poke round pegs into" This app acts to constrain data input to fit particular document characteristics such as length of text centered at a particular size to fit nicely in a bounding box within an A4 portrait document. Or A3 or A5 or A6 or landscape. The up shot of this is that the graphics designer stops being a data entry clerk and editor when he recieves a CSV of items to be printed off. He would need to wander thru thousands of these items making sure text didnt spill over background objects or flow outside of document. He would need to manually adjust and call owner of data to re-edit text so it would fit. We calculated he was spending 22-32(time of year) hours a month on this labour that was costing my employer and detracting from what he was employed to do by his company. He hates it. The onus of compisition and constraint was put on the consumer of the printed output. If constraints are violated they cant be submitted.
The data for each template consists of one html fragment representing the text areas (divs and clever usage of "data-" attribute prefix), one style sheet for preview as you type, one background image, and one xslt sheet to transform the web service into something indesign script can parse easily and i dont need to shoot myself. I wrote the indesign client using "extendables" http() which gets a list of published batches and he can punch the XML straight into indesin(he can now thanks to you)
The app itself is an engine which runs these sheets and creates data input fields, data verification, store to mssql 10 and retrieve for editing and a searchable (searching XML types in tuples BTW )library keyed in on the document type context. There 8 of these contexts so far representing portrait and landscape for A4 A5 A6 and a big A3 6x3 items per page. There is a security layer in asp.net membership and roles which i have tweaked a little
It's all done! I need to sit with the GD so we can put the existing document templates into library objects so the script can retrieve them and perform the type of work we have been discussing. The two parties are gobsmacked by the look and consistancy of data styling. The user interface needs some work since  c# puts it together, but i'm not really a designer. Sorry for rabbiting on, I wanted to tell someone who might be the slightest bit interested in what or how i did.
Thanks again

Similar Messages

  • I have created a form that contains fields with default text for a user to update/personalize.  Is there a way to style the text so I can quickly identify changes to default text in a field?

    I have created a form that contains fields with default text for a user to update/personalize.  Is there a way to style the text so I can quickly identify changes to default text in a field?

    George - Thanks you so much!  Actually, i'd love for the text color to be red font color.  Could you send me the script for that? And I assume I just copy and paste the script into the field properties (see screenshot)?
    thanks again!
    Seth

  • Can't link a style to text on a page; text keeps changing to black instead of blue

    I have links to the web pages I'm working on at the bottom. I
    am trying to make the text and color consistent on two pages on the
    website I am working on. One page is a printer friendly version of
    the other. [I have looked and looked under Dreamweaver Help but I
    can't figure this out.]
    I have somehow created a CSS style called "rental blue
    arial" and I've linked it to the first page and applied the style
    to text. I can't for the life of me remember how I did that, and
    now I'm trying to connect that style sheet to the print version of
    that page but I can't. When I go to the CSS style sheet the
    properties and links are grayed out. On the printer friendly page I
    don't see "rental blue arial" in the list of styles. I always
    select the whole table on the regular non-print page and copy it to
    the printer friendly page but when I do all the text formatting is
    lost and the text appears different colors.
    What can I do or can someone fill me in? I know it's basic,
    but I can't figure this out. Also, I notice that the person who
    created the website has 10-12 styles associated with each page but
    they're not CSS styles and I don't know how he created them; I
    can't figure out a way to create just a style, not a CSS style. So
    here are links to the web pages I'm talking about:
    regular page:
    http://www.chatelrealestate.com/rentals.htm
    printer friendly page with messed up colors:
    http://www.chatelrealestate.com/rental_print.htm[b

    >>I notice that the person who created the website has
    10-12 styles
    >>associated with each page but they're not CSS styles
    No such thing. Those are CSS styles
    >>I can't figure out a way to create just a style, not
    a CSS style
    Again, there is no such thing as a style that is not a CSS
    style.
    It looks like you have not taken time to understand CSS.
    Until you do so you
    will have more frustration than satisfaction. The page I've
    looked at are a
    mess. There are many embedded CSS styles with non-descript
    names. That makes
    maintaining and updating the site a nightmare. Suggest you
    pull all those
    embedded styles into a single style sheet, sort out what they
    are supposed
    to do, use descendant selectors where possible and give each
    style a
    meaningful name.
    BTW there is no style sheet attached to
    http://www.chatelrealestate.com/rental_print.htm.
    Go back to DW Help and
    learn about attaching style sheets.
    Walt
    "Jen_26059" <[email protected]> wrote in
    message
    news:[email protected]...
    >I have links to the web pages I'm working on at the
    bottom. I am trying to
    >make
    > the text and color consistent on two pages on the
    website I am working on.
    > One
    > page is a printer friendly version of the other. [I have
    looked and looked
    > under Dreamweaver Help but I can't figure this out.]
    >
    > I have somehow created a CSS style called "rental blue
    arial" and I've
    > linked
    > it to the first page and applied the style to text. I
    can't for the life
    > of me
    > remember how I did that, and now I'm trying to connect
    that style sheet to
    > the
    > print version of that page but I can't. When I go to the
    CSS style sheet
    > the
    > properties and links are grayed out. On the printer
    friendly page I don't
    > see
    > "rental blue arial" in the list of styles. I always
    select the whole table
    > on
    > the regular non-print page and copy it to the printer
    friendly page but
    > when I
    > do all the text formatting is lost and the text appears
    different colors.
    >
    > What can I do or can someone fill me in? I know it's
    basic, but I can't
    > figure this out. Also, I notice that the person who
    created the website
    > has
    > 10-12 styles associated with each page but they're not
    CSS styles and I
    > don't
    > know how he created them; I can't figure out a way to
    create just a style,
    > not
    > a CSS style. So here are links to the web pages I'm
    talking about:
    >
    > regular page:
    http://www.chatelrealestate.com/rentals.htm
    > printer friendly page with messed up colors:
    >
    http://www.chatelrealestate.com/rental_print.htm[b
    >

  • How to assign modified forms (SAP scripts etc.,) to Dunning texts

    Hello, how do I assign forms (SAP scripts etc.,) to dunning texts according to no 5 above?
    I've copied the form f150_dunn_01 and modified it. Now I want to assign my modified form to dunning text. In txn fbmp I have created new procedure and when I clicked on Dunning texts it takes me to dunning text screen where I should be able to assign my modified form. But the screen is greyed out and not editable. Is there anything I'm missing or I've permission issue?
    Please help
    Regards
    Naz
    Most of the config for Dunning is done with TCode FBMP.
    Key Steps are :-
    1.     Define the dunning procedure or use the standard
    2.     Define the dunning levels (desired stages of reminder)
    3.     Define the dunning interval (frequency of reminder)
    4.     Line item grace periods & Min.days in arrears (acct) govern the criteria for picking items to be dunned along with Minimum amounts
    5.     Assign forms (SAP scritps etc.,) to dunning texts. Forms contain the contents of the reminder notice and the format of notice.
    6.     You can include the Sp GL Transactions as well.
    7.     Customer/Vendor Master Records needs to be updated with the Dunning
    8.     Procedure etc, Dunning tab in the master data
    9.     Use F150 to run.

    Hi Praveen,
    Ok let me go through the steps that I have done so for.
    1. New dunning procedure 004 been created in Txn FBMP
    2. Then by choosing the assigned dunning procedure 004, trying to update the form by selecting the company code and then Dunning text. But the screen is grayed out.
    Please pass me your email address then I will send you the screen shoots.
    Thanks
    Naz

  • A challenge to Adobe: Allow me to use inline styles in DW by default or I dump DW

    Years ago I switched from FP to DW because FP started forcing people to use CSS over HTML. That was FP 2000. I switched to DW because it respected my code... Now that CSS is mainstream and we are all in love with it, DW CS4 decides to throw a bone and tell me to fetch -- forces me to use CSS rules. I am fine with Adobe hurting my intelligence but at the very least I need the ability to convert CSS rules to inline styles. I do a lot of HTML emails for clients and as I am sure you know, Adobe, most [web] email clients ignore external CSS and <style> tag. Or let me put it this way: I simply want to choose between inline style and rules based on type of project. No questions or comments please.
    So Adobe, you can remove this post right away if you like, but here is the challenge for you: If in a month you do not update DW SC4 to allow me to choose whether I want to use CSS rules at all + if you do not provide the ability to convert all CSS rules in a page to all inline I dump DW altogether. How's that? Also please check your records and see that I recently purchased your CS4 Master Collection. I am a serious CS4 user and this is a serious challenge.
    With DW CS4 you abandoned DW's character of being a TOOL that lets users decide how to code. Redemption period of 1 months starts.... NOW. Tic toc, tic, toc.

    Hey anygiven. Appreciate your observations. I also feel that Adobe has lost its way as far as the Web is concerned.
    Here's another example from the Dreamweaver Help files. In the second video down on the Dreamweaver CS4 launch screen, called "Live View" (which isn't, BTW), the Adobe talking heads spend a lot of time on how to use a Yahoo calendar widget to create a calender of coming attractions. They make it sound cool and contempo and "next generation."
    As a longtime webmaster with a small client who owns a bar & grill on the Oregon coast, I react to this Adobe video in two ways. First, if my client's competition is using Dreamweaver and following Adobe's directives, I'm absolutely thrilled. Couldn't be happier. Here's why. In the Real World, it's crucial to get search engine traffic to the calendars. But if you do what Abobe suggests in their "Live View" (Not) video, you will get just about zero search engine traffic to your calendar because the search engines can't fully index pages whose content changes in response to user actions! Boiled down, if you do it Adobe's way you'll spend a lot of time and energy to get significantly less functionality in your coming attractions calendar, and thereby deliver less value to your client.
    So in a way, Adobe's Real World Web cluelessness actually helps me by making Adobe-led webmasters less effective and easier to beat. The problem here -- for me and everyone else -- is that is that Adobe and Dreamweaver have no competition any more. I'd be delighted to stand on the shore and watch the grief on the good ship Adobe from the distance, but I can't do that because in the so-called "free market economy" I don't have that fundamental freedom of choice any more.
    I've also begun to wonder about my freedom to express my views here. Last month, I posted a comment noting the basic problem with the Dreamweaver CS4 calendar widget video in the comments section at the bottom of http://tv.adobe.com/watch/inside-the-dreamlabs/dreamweaver-cs4-live-preview/, and it was deleted by Adobe. As of February 22, 2010, the last comment on the page now reads: "Excellent video." That'll take care of the issue! I paid $800 for CS4 (on top of a shelf load of Adobe products going all the way back to 1992) and I logged in, but I don't get to offer an honest (and helpful) comment if it doesn't support the current Adobe dogma?
    I hope that's not the case. I hope there's just some sort of honest misunderstanding here. I also hope that Adobe can appreciate that this is not just empty complaining. I'm not sitting here moving my mouth because it feels good. I'm taking the time out of a very busy morning to offer these comments because as an independent Web developer I believe it's imperative for Adobe to rethink where it's taking Dreamweaver.
    Among the issues crying out for Adobe's reconsideration:
    * Cascading Style Sheets. CSS is a hideously bad implementation of a decent-enough idea. Because of its inherent design flaws, CSS will never be adopted widely UNLESS people don't have a choice. Adobe should stop making Dreamweaver an agent of Web totalitarianism by removing the webmaster's choices as to how he/she constructs their pages. Just say "no" to the Code Nazis.
    * Feature Loss. Adobe needs to start adding features and functionality to Dreamweaver, instead of taking features out as is the case with Dreamweaver CS4. Like the man said, Job One should be to bring Dreamweaver up to the same functionality that FrontPage had 15 years ago in 1995, including all the Web Bot functions. (I realize that it might take a couple of versions to get Dreamweaver up to full FrontPage functionality, but high on my list for the first version upgrade would be a robust threaded discussion group component AND the ability to include blog-like comments at the bottom of the pages.)
    Like to see some positive response here from Adobe to these issues that have been raised by longtime, professional customers...

  • Convert Script output data to Text(.txt) file & send mail with attachment.

    Hi All,
    Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
    Plese sugget with Function modules to cover as Text file.
    I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
    Thanks in advance.

    Hi, Thanks for responst.
    We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
    Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
    Thanks.

  • How to enable the script label of a text frames in indesign using applescript

    hi all,
    am using Indesign CS2 with applescript..
    Using script I have to open a template in indesign and flow the word document into it...
    I can able to flow the word document into the template using "Place" command..but script labels of the text frames gets disabled...
    I need the script labels to be enabled...
    can anybody help me
    thanks in advance

    Script labels can't be disabled, so I'm not sure what your problem is -- perhaps seeing some code could help. Could it be that you're referencing a page item by label, but it is not responding because the item is part of a group?
    Shane Stanley <[email protected]>
    AppleScript Pro Sessions <http://scriptingmatters.com/aspro>

  • Script to update legacy text (action does not work)

    So here is my scenario: I did select all and update legacy text but I have some issues with some type paths that are being clipped. OK, easy enough let me unselect those layers and run "update selected legacy text" GREAT WORKS!
    Here is my delima I have 400 .eps files that I am doing this on. The layer names are always the same so I was wondering if there was an easy way to do this on an action. Does an action know that I am unselecting a layer after selecting all? Why doesn't it record when I do
    Type>Legacy Text>Convert Selected Text?
    • Select all
    • Unselect two layers (layers name consistent)
    • Type>Legacy Text>Convert Selected Text
    Is this easy in a script to pull off?

    #target illustrator
    // script.name = legacyTextConvertToNative.jsx;
    // script.description = converts Legacy Text to Native from all layers, except from 2 layers, hard codes below.
    // script.required = 2 layers named the sames as the names shown below in skipLayer1 & 2
    // script.parent = CarlosCanto // 7/23/11;
    // script.elegant = false;
    var idoc = app.activeDocument;
    var skipLayer1 = "CAPTIONS HYDROGRAPHY"; // replace with your own layer name
    var skipLayer2 = "CAPTIONS RELIEF"; // replace with your own layer name
    for (i=0; i<idoc.layers.length; i++)
              var ilayer = idoc.layers[i];
                   if (ilayer.name!=skipLayer1 && ilayer.name!=skipLayer2)
                             for (j=0; j<ilayer.groupItems.length; j++)
                                       var igroup = ilayer.groupItems[j];
                                            for (k=igroup.legacyTextItems.length-1; k>=0; k--)
                                                      var ilegacy = igroup.legacyTextItems[k];
                                                      ilegacy.convertToNative();
    The two that are locked are the ones I name in the script and are the ones I do not want edited.
    There is your script the layers that is not getting updated for example is the: "CAPTIONS COUNTRIES" & "CAPTIONS TOWNS"

  • How to display HTML formatted text in the field with Item Style: Raw Text

    How can I display HTML formatted text in the field with Item Style: Raw Text.
    Currently the Item Style is Raw Text, but the text is being displayed along with HTML tags without formatting.
    Regards

    Hi,
    Use Item Style formattedText.
    Regards,
    Gyan

  • Is possible to have a script that makes a text randomly have caps and lower caps... i would love to create a kind of effect so it would look like manuscript - but it cannot be only the same letter in caps or lower caps - I wOuld NeEd oF SOmeTHing LikE Thi

    Is possible to have a script that makes a text randomly have caps and lower caps... i would love to create a kind of effect so it would look like manuscript - but it cannot be only the same letter in caps or lower caps - I wOuld NeEd oF SOmeTHing LikE This (random) - is it possibel?

    Hi,
    Sample with 2 regex:
    Launching the 1rst regex:
    Launching the 2nd regex:

  • How to display text in script as same as text in news paper

    Hi Expets
    I have a requirement i need to display text in script as same as text displayed in news paper
    with out creating any windows. iie ( Abcdef should be in one cloum after some space i need to display 1234)
    please let me know how can i achieve this
    Ex
    1.
    hi abcdef           12345
        abcedf          12345
    abcedf            12345
    Regards
    Suresh
    Edited by: suribabu124 on Jun 15, 2010 7:55 AM

    Hi,
    If you need to print a form like news paper you need go for multiple main windows.We know that we can use 99 main windows in one page.first create one main window and then leave a space then create one more window and select window type as mainwindow.
    while populating data,after completion of one main window the control will move to next main window,which is in the same page.
    Like this you need to analyse and code according to your requirement.

  • Inline style - decimal value for dimension break designer

    Hi all.
    I'm using JDeveloper 11.1.2.1 & ADF.
    Just to let you know that decimal value in dimension css selectors (like width...) added using inline style break UI designer.
    af:tree table -> nodeStamp facet -> column -> inlineStyle -> width:305.0px break UI designer.
    Replacing 305.0px with 305px makes everything work Ok.
    .0 part in inline style was added by JDeveloper 11.1.1.5, while JDeveloper 11.1.2.1 doesn't add decimal part.
    Regards.

    Frank, this is i minor issue but it took me 1hour to find what breaks UI designer.
    What I did is just migrated adf application from JDeveloper 11.1.1.5 to 11.1.2.1.
    In JDeveloper 11.1.1.5, when you enter width using property inspector -> style -> layout -> dimension -> width property, let say 305 and select pixel in side drop down list, what you get as result is inlineStyle property like this:
    inlineStyle="width:305.0px"
    Frank Nimphius wrote:How would 305.2 pixel look like ?You should ask Oracle to answer this question.
    Thank you for your reply.

  • Set the css style of text in a column according to the value of another col

    I'd like to set the css style of text in a column according to the value of another column. Each field may end up with a different style of text as a result, for instance.
    Any ideas? I looked thru the forums but couldn't find anything.
    Thanks,
    Linda

    Does the class=”t7Header” make it into the rendered HTML?
    ---The text "class="tHeader" does not show but the other text is rendered using the style t7Header as defined in the stylesheet! Exactly what I wanted.
    You might want to use a div or a span instead of a p.
    ---Yes -
    What's very cool is we can create a display column that is dynamically filled with the html and style wrappers based on a lookup to see what style should be applied according to the actual data value. This is critical as our tables are all dynamic so I can't depend on using the additional APEX methods to control the display of a column (as the # of columns in the view vary from instance to instance) and I did not want the display specs to muddy up my SQL queries.
    I wonder why this is not well documented. It is so easy!
    Thanks again for your help.
    Linda

  • How to use inline style for hover, visited

    I am trying to use inline styles for a hover effect or a
    visited. I know how to do it using a style sheet but not inline.
    Is it possible to do this?

    That's OK. The chances were 1 in 2 you'd be right. It's
    better than buying
    yourself a lottery ticket....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Walt F. Schaefer" <[email protected]> wrote in
    message
    news:gf2c8o$h0c$[email protected]..
    > Whoops!
    >
    > :-(
    >
    > --
    >
    > Walt
    >
    >
    > "Murray *ACE*" <[email protected]>
    wrote in message
    > news:gf29m1$dr7$[email protected]..
    >> Nope, not possible using inline styles.
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Adobe Community Expert
    >> (If you *MUST* email me, don't LAUGH when you do
    so!)
    >> ==================
    >>
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >>
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >> ==================
    >>
    >>
    >> "Walt F. Schaefer" <[email protected]>
    wrote in message
    >> news:gf26t4$aa5$[email protected]..
    >>>> Is it possible to do this?
    >>> Sure. Show us what you've tried (a link to an
    uploaded file is best) and
    >>> we'll see why it doesn't work.
    >>> --
    >>>
    >>> Walt
    >>>
    >>>
    >>> "craigmini" <[email protected]>
    wrote in message
    >>> news:gf25ul$98a$[email protected]..
    >>>>I am trying to use inline styles for a hover
    effect or a visited. I know
    >>>>how to do it using a style sheet but not
    inline.
    >>>> Is it possible to do this?
    >>>
    >>>
    >>
    >
    >

  • Printed documentation missing some inline styles

    I'm using RH HTML 7, Word 2003, and my own Word template file.  Some of the inline style information is not being applied to the Word output.
    Example:  In both RH and Word, the Normal style has 14 pts of space before and after the paragraph.  In one location in RH, I overrode that and set the before and after spacing to 0.  However in the Word document, the paragraph spacing is set back to 14 pts and results in too much whitespace.
    Shouldn't this inline style be applied after the external Normal style is applied?  Other inline styles (e.g., Bold) work fine.  It's just the paragraph spacing that's giving me problems.

    Do they appear in Word? What version of Word? Is it always
    the same images? How much RAM do you have?

Maybe you are looking for