HELP!!! Creating Text using script

Hi there,
I am writing a script which creates a text frame and adds text in it. The problem is, I want to add some information below everytime on many documents. Instead of copying from other sources everytime, I thought of writing a scirpt which by clicking creates a text frame and puts text in that because it is the same for all. Now two issues:
1) It is coming but in the first page. I need that in the working page, for example clicking that it should come in page 2 or 4 and not in the first page.
2) The text has a word should be in quotes giving like that the script shows error. My example code is given below:
var myDocument = app.activeDocument;
var myTextFrame = myDocument.textFrames.add()
myTextFrame.geometricBounds = ["11.2in", "8in","10.99in","0.5in"];
myTextFrame.contents = "This is a "sample" text.
Please try without quotes first. Without quotes for sample word it is coming in the first page. With quotes it shows error.
What is the solution. 1) need to add on the current working page. 2) should also include a word within quotes.
Help really appreciated!

Hi Prasant,
1) Add a text frame to the active page
2) Escape quotes in the string \"
var myDocument = app.activeDocument;
// Ruler origin should be set to Page
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
var myTextFrame = app.activeWindow.activePage.textFrames.add();
myTextFrame.geometricBounds = ["11.2in", "8in","10.99in","0.5in"];
myTextFrame.contents = "This is a \"sample\" text.";
Kasyan

Similar Messages

  • Unable to create text using SAVE_TEXT FM

    Dear Experts,
    I' m trying to automaticly create a text in Create measurement Document (IK11 in PM) when notification is created . For this in program IMRC0004 on exit i put FM SAVE_TEXT but its not working as it should.
    BAPI_ALM_NOTIF_CREATE & BAPI_ALM_NOTIF_SAVE is used to create notification & in order to create text SAVE_TEXT  is used.
    But when the document is saved the specific text is not created. In debug the FM returns with no error.
    Can anyone help me?

    Hi,
    try to check the FM READ_TEXT by passing the same parameters used in SAVE_TEXT and check.whether read text is working.
    if read text is workingthen save text is working.
    and also see the parameter    SAVEMODE_DIRECT import parameter in save_text if it is X it will save every tiome if it is space it will save at LUW(when Logical unit of work executes)
    Prabhudas

  • Create user using Script

    Hi
    Does any body know how to create user in BI answers using any Script?
    Thanks.

    1. Create a text file with the UDML to create a new user(s):
    DECLARE USER "NewUser" AS "NewUser" UPGRADE ID 1 FULL NAME {New User} PASSWORD '' PERIODICITY 90
         HAS ROLES (
              "Administrators",
              "XMLP_ADMIN" )
         DESCRIPTION {password = Empty}
         PRIVILEGES ( READ);
    Merge it with your your current repository using nQUDMLExec.exe
    E:\OracleBI\server\Bin>nQUDMLExec.exe -U Administrator -P Administrator -I E:\temp\NewUser.txt -B E:\temp\paint.rpd -O e:\temp\newrep.rpd
    Regards John
    http://obiee101.blogspot.com/

  • Need help creating text based game in Java

    Alright, I'm taking a big leap and I'm jumping a little out of league here. Anyways here are my two classes...I'm sure I've got plenty of errors :-/ One other thing. I have only programmed the battle section of the program so don't worry about the other 5 sections when fixing the code.
    import cs1.Keyboard;
    public class Knights
        public static void main (String[] args)
            // Object Declaration
            KnightsAccount player1 = new Account (1, 100, 200);
            // variable declarations
            boolean run = true;
            int choice;
            // Game Start
            System.out.println ("Welcome to Knights.");
            System.out.println ("--------------------------------------");
            System.out.println ("You are a level 1 character.  With 100 HP and 200 gold...good luck.");
            System.out.println ();
            while (run == true)
                System.out.println ();
                System.out.println ("Enter the number of the option you would like to do");
                System.out.println ();
                System.out.println ("1. Battle");
                System.out.println ("2. Train");
                System.out.println ("3. Work");
                System.out.println ("4. Rest");
                System.out.println ("5. Stats");
                System.out.println ("6. Quit");
                choice = Keyboard.readInt();
                if (choice == 1)
                    player1.battle();
                else if (choice == 2)
                    player1.train();
                else if (choice == 3)
                    player1.work();
                else if (choice == 4)
                    player1.rest();
                else if (choice == 5)
                    player1.stats();
                else
                    run = false;
    }And here is the second class...
    import java.util.Random;
    public class KnightsAccount
        public String winner;
        public int exp = 0;
        public void Account (int level, int hitPoints, int gold) {}
        public battle ()
            Random generator = new Random();
            int pumpkinHP = 80;
            int playerAttack, pumpkinAttack;
            System.out.println ("Engaged in combat with an Evil Pumpkin!");
            while (hitPoints > 0 && pumpkinHP > 0)
                if (pumpkinHP > 0)
                    playerAttack = generator.nextInt(15);
                    hitPoints -= playerAttack;
                    System.out.println ("Player 1 attacked Evil Pumpkin for " + playerAttack + ".");
                    System.out.println ("Evil Pumpkin has " + hitPoints + " HP left.");
                if (pumpkinHP <= 0)
                    pumpkinDead();
                if (hitPoints > 0 && !(pumpkinHP <= 0))
                    pumpkinAttack = generator.nextInt(12);
                    hitPoints -= pumpkinAttack;
                    System.out.println ("Evil Pumpkin attacked Player1 for " + pumpkinAttack + ".");
                    System.out.println ("Player 1 has " + pumpkinHP + " HP left.");
                if (hitPoints <= 0)
                    playerDead();
            return winner;
        private pumpkinDead ()
            System.out.println ("Success!  You have defeated the Evil Pumpkin with " + hitPoints + "HP left!");
            System.out.println ("For you good deed you earned 20 exp.");
            exp += 20;
            return exp;
        private void playersDead ()
            System.out.println ("You have been defeated.  Go home before we pelt melty cheeze at you.");
    }Whoever can help me I'd be grateful. I know there are probably a lot of things wrong here. Also if some of you could post your AIM or MSN so that I can get some one on one help on any of the smaller problems I run acrost that would help a lot too.
    Duke dollars to whoever helps me ;)
    AIM: Trebor DoD
    MSN: [email protected]

    You should really create a GameCharacter object that contains the
    statistics for a character (player or non-player) in the game.
    public class GameCharacter {
       private double attackStrength;
       private double defenseStrength;
       private String name;
       private String[] bodyParts;
       private Random = new Random();
    public GameCharacter(String name, String[] bodyParts, double attackSt, double defenseSt){
       this.attackStrength = attackSt;
       this.defenseStrength = defenseSt;
       this.bodyParts = bodyParts;
       this.name = name;
    // put lots of methods in here to get and set the information
    public String getName(){
      return this.name;
    public String getRandomBodyPart(){
       return this.bodyParts[random.nextInt(this.bodyParts.length)];
    }You then create your "knight" character and your "rabid pumpkin"
    character.
    Your fight method then just takes two GameCharacter objects and uses
    the information they contain to fight the battle.
    public void fight(GameCharacter a, GameCharacter b) {
       boolean fightOver = false;
       Random rn = new Random();
       double attackValue;
       while(!fightOver) {
           attackValue = a.getAttackStrength()*rn.nextDouble();
           System.out.println(a.getName()+" attacks "+b.getName()+"'s "+b.getRandomBodyPart()+" for "+attackValue+" points");
    }The above is not the fighting loop of course. I just put it in to
    demostrate how the fight method can be made generic. It takes any
    two characters and uses their defensive and attack information to
    calculate the fight outcome. It also uses the descriptions that the characters have
    to make the fight more interesting. (the getRandomBodyPart method in
    particular)
    matfud

  • Creating text using outlines and gradients/fills

    I've been using pages awhile, and I make a lot of posters with it for my classroom. I know it has some limitations.
    I really want to take text, make a bold black outline of it (format > font > outline), and then fill it with a gradient, or at least a fill color. I am able to color, or outline, but not both, and I cannot find the option to make gradients except on backgrounds or shapes. Is there a way to do that in 2.0, before the next update?

    Welcome to the forums.
    This can indeed be done, but it is a very cumbersome process, because the text needs to be made into an object, and that can't be done from within Pages.
    The process involves creating the text in some external drawing application (such as Illustrator or the free Inkscape, saving the file as an SVG file, using svg2key to convert the SVG file into Keynote objects, then copying those from Keynote into Pages (which uses the same object format as Keynote).
    Once you have these as objects, you can reuse them as you like, changing their colour, stroke, and size like any other object, so you may only need to do this once for an "alphabet" that you reuse.
    I certainly do hope that the next update lets one create outline text directly within Pages.

  • Vertical text using script

    In one of my templates, the designer has vertical text in a textframe in the first page. I don't think he used the "type on a path line" tool. I don't think he uses a style do it either.
    In my script, I add 2 pages to the template and 2 textframes. I want the textframes to show the same vertical text in the same geometric bounds. How do I do this using the script?

    One more question, is it possible to have two text boxes side by side using this script and have them flex or move depending how long the text is? Or would this require more complex code?
    thanks

  • HELP Create Extenstion using JFrame instead of JPanel (10.1.3 Release 3)

    Hi,
    I manage to create a custom GUI editor in JDev but if i switch it to JFrame, JDev GUI Designer display nothing but an invinsible frame.
    I'm using sample from customeditor in extension sdk
    Any ideas ?
    Thanks

    It seems that you are trying to use a JFrame as the GUI of your custom editor. The JFrame is a heavy weight component (has a real window behind it). In JDeveloper custom editors must not use JFrames or AWT Frames as their root GUIs. The windows of these frames will paint on top of other editors even if they are behind in the component stacking order.

  • Need Help Creating a Startup Script

    I'm using a WebApp called OpenTaps/OFBiz on my built-in server, and to use it I must use the Terminal App to get it started each time I restart.
    I'm looking for a way to have it start automaticallly each time I restart.
    Here's the commands I use in the Terminal to do so:
    $ cd /Library/Webserver/Documents/opentaps
    $ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home
    $ ./startofbiz.sh
    $ tail -f logs/console.log
    Could someone tell me what to wrap around this code to load it at startup, or perform these functions some other way automatically?
    I posted here because I don't know if Automator can do this for me or if there's a more elegant technique.
    thanks
    R
    G4 Desktop, G4 iMac, & G3 iBook, G4 iBook   Mac OS X (10.4.7)  

    Follow the instructions here or here to create a login hook, which is run whenever any user logs into the computer.
    (15985)

  • Can't create text with PHP using imagettftext [SOLVED]

    I think that after the upgrade of PHP to the modular one I can't create text using TTF fonts. Before I file a bug report could someone confirm if it works or not for them? I might just have screwed something in my box.
    This code should create a text image and display it in the browser (it assumes you have DejaVu fonts in the default directory):
    <?php
    // Set the content-type
    header("Content-type: image/png");
    // Create the image
    $im = imagecreatetruecolor(400, 30);
    // Create some colors
    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);
    // The text to draw
    $text = 'Testing...';
    // Replace path by your own font path
    $font = '/usr/share/fonts/TTF/DejaVuSans.ttf';
    // Add some shadow to the text
    imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
    // Add the text
    imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
    // Using imagepng() results in clearer text compared with imagejpeg()
    imagepng($im);
    imagedestroy($im);
    ?>
    Could someone with an up to date php with GD enabled tell me if it works or him/her?
    Thanks.
    EDIT: Ok, I solved it. The error reporting is turned off by default now, so I was not getting any error. After turning it on I found out it was related to the open_basedir directive being enabled now in php.ini. Turning it off allowed me to access the TTF for drawing text.
    Last edited by Bogart (2007-11-01 00:43:33)

    Aha!  I figured it out.  I used File...Open As to open it as a Camera RAW file.  In the ACR editor, it was showing as 16-bit depth.  Changed it to 8-bit and saved it.  Now the Text tool works!
    Ken

  • Created text, now can't edit or select it???

    I have created text using the typwriter tool, I selected it then copied and pasted it but now I cant select or edit either the original one or the copy. I find acrobat one of the most frustrating softwares I have ever used for simple task as editing text.
    Any help would be really appreciated.
    Many thanks
    Nick

    Hi all,
    Many thanks for your replies, I did manage to work round it as LoriAUC sugested, I just found it very difficult to do what seems like a simple task, I was completing a form that I had recieved and one of the fields wouldn't let me put text in it correctly hence I used the typwriter tool. But sorted it now. I get that Bill2VT, it seems to be very limited in its editing capablities text wise, and I will have a look at the tutorials thanks Alec.
    Again, thanks for all your help.
    Regards
    Nick

  • Read Text using SO10

    Dear all,
    i m Creating Text using SO10.
    Now i want to Bold or High light some text and want to change font size.
    how can i.
    actually first time i m using SO10 for creting own text.
    Thanx in advance

    Hi,
    Use the character format in the standard text. It automatically shows the format which you want. If you are assigning SO10 text in smartform don't forgot to assign style to the text node.
    Example:
    write the message like below
    <C1>Message</> <C2> is here</>
    After C1 close your message with /
    Make sure that Character formats C1 & C2 should be there in the style format.
    Regards,
    vinod

  • Selecting particular range of style using script

    HI All,
    Can anyone suggest me that how we can select the range of text using script.
    I am having some different para styles say for eg., PS1, PS2, PS3, PS4...........
    I may applyed these styles in some jumping order but except PS1, now I want to select paragraphs with applied style PS1 to stop before the next appearence of PS1 style.
    Like: In a document Para 1, 10, 14, 25 were applied with PS1, so the selection should go in the way like 1-9, 10-13, 14-24 and so on
    Regards,
    love_all

    "The" index of a paragraph is nothing special, it's the index of the first character of that paragraph inside its parent story. In particular, it does NOT tell you "this is the 5th paragraph" or something like that.
    This is because "Paragraph" is an artificial construct inside "Text", not a truly existing first class object. Same as "Line", "Word", "Character", and indeed, any text selection at all.
    Since you already have a "found text" array, "the index" of the nth entry's paragraph -- with the constraint described above -- can be simply found by using foundText[n].paragraphs[0].index (the index of the first character of your foundText is foundText[n].index).
    If you DO need to know the nth number of the paragraph, search this forum. I think Peter Kahrel answered to a post to answer that exact question.

  • How to call text file using Script in Data Integrator

    Dear All,
    Can any one assit me in how to call a text file using script with the help of Data Integrator.
    and one question ?
    M having 32 csv files i want to club thos 32 csv files into one table with the help of Data Integrator, can
    any one assist me.

    mary,
    since you knew the file name ,when clicked in name send to server,read the file and write to servlet outputstream.
    I think this would help you.
    If anything wrong in mycode ..forums will help you further
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    int bytesRead=0;
    byte buff[]=new byte[1024];
    File f=new File(test.txt);
    try{
         bis= new BufferedInputStream(new FileInputStream(f));
         bytesRead=bis.read(buff,0,buff.length);
         if(bytesRead!=-1){
              // create a BufferedOutputStream from ServletOutputStream
              bos=new BufferedInputStream(response.getOutputStream());
              do{
                   bos.write(buff,0,bytesRead);
              }while((bytesRead=bis.read(buff,0,buff.length))!=-1)
    }catch(Exception e){
         ////error handling
         }

  • Automatically Create Hyperlink Using Product Name in Document Text

    Hi,
    I've recently been told that all the product names in our PDF documents from here on out have to link to their product pages on our web site. This is a problem because any given document could contain dozens or a hundred references to products. Before I try my first attempt at creating an Indesign Script (on something that sounds kind of complicated for a novice like me) I was wondering if there any existing scripts out there that do something like the following:
    Find all instances in the text of product names beginning in AD and ending in either a number (digit) or the lowercase letter "x."
    Style those instances in a predefined URL character style (basically styling it in blue).
    Create a hyperlink to the product page using the product name found in the text. Taking the product name--AD4056, for instance--and creating a hyperlink by adding http://www.corpsite.com/ to the front of the URL and adding the product name to the end.
    So the end result, for example, would be that a product name like AD4056 would be set in the URL character style, and would have hyperlink added that, when in the exported PDF, would take you to the product page, http://www.corpsite.com/ad4056.
    It seems like it might be a relatively common problem, so I'm hoping that someone out there may have a resource already available. Oh, I'm on Indesign CS5 on a PC. Would prefer Javascript so our vendors could use it on a Mac, but PC-centric is OK too. If not, I'll get to crackin' on making it myself.
    Thanks in advance for any pointers!

    Here you are. As you see, it's quite complicated -- InDesign needs a destination URL, a virtual hyperlink, and an instance of this virtual hyperlink. All in all it took me a couple of tries before I got it right. (It didn't help your example URLs don't exist yet )
    d = app.activeDocument;
    url_style = d.characterStyles.item("URL style name");
    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = "\\<AD\\w+[\\dx]\\>";
    sourceList = d.findGrep();
    for (l=0; l<sourceList.length; l++)
         link = d.hyperlinkURLDestinations.add ( "http://www.corpsite.com/"+sourceList[l].contents);
         d.hyperlinks.add ( d.hyperlinkTextSources.add (sourceList[l]), link ).name = sourceList[l].contents+" ("+l+")";
         sourceList[l].appliedCharacterStyle = url_style;

  • Using Standard text in scripts

    Hi all,
    I had a problem while printing standard texts in scripts.
    I Know how to print standard text if we have to print it from the begining of window using
    INCLUDE &T024E-TXADR& OBJECT TEXT ID ADRS LANGUAGE &EKKO-SPRAS& PAR
    But my problem id i have print it after a hard coded text like
    Delivery schedule: 'here i have to print the standard text'.
    can any one please help me out how to solve the problem
    Thanks & regards
    sreehari p

    Hi,
    Here's one my brother taught me - you can actually trick the system to accommodate this requirement.
    Ensure that you use 2 different paragraph formats in your INCLUDE statement, using the PARAGRAPH and NEW_PARAGRAPH clauses, ie.
    INCLUDE &T024E-TXADR& OBJECT TEXT ID ADRS LANGUAGE &EKKO-SPRAS& PARAGRAPH P1 NEW-PARAGRAPH P2
    Paragraph P2 (which will be used as the first line) should be created as having a Line Spacing value of 1 TW (1 twip) which is less than 1/1000th of an inch.  Also, set the Left Margin value to an offset which brings the text to the right of the Delivery schedule literal.
    Paragraph P1 (which will be used for all subsequent lines) should be set up as normal - ie. use the same paragraph format as that for displaying your "Delivery schedule:" literal.  If you need the text to be indented in line with the first line, then copy your existing paragraph to a new paragraph but set the Left Margin value to the same as that in P2.
    What this does is to output the first line of text indented by the margin after skipping 1 twip, giving the illusion that it's actually on the same line.  Since subsequent lines are output with a normal (or normal/indented) paragraph, that just follows with normal spacing on subsequent lines.
    Hope this makes sense.
    Regards,  Andy

Maybe you are looking for

  • Ms-6183 won't boot after storm

    Following a recent thunderstorm, my ms-6183 system no longer boots.  After powering on, I get the normal single beep, fans, hard drives, etc start up, but screen stays blank (no signal message).  There is no HDD activity, and it won't boot from flopp

  • IPhoto and External Hard Drive ?

    I am going to move my iphoto library to an external hard drive so that I can have more space on my internal drive. I travel for work and take hunderds of pictures during each trip. While I am away I want to be able to put the pictures on my laptop th

  • How to drag and drop icon in the browser

    hi i Have A web page that i should drag some responces from right to their correct location in Left.in pc I hold left mouse buttom and drag icon into its Correct place and drop it but I can't do that on the android browser. how should I do that? and

  • Render queue taking FOREVER

    I'm trying to export a 12 second comp and it's taking an extremely long time.  I've tried and cancelled several times now, from both the AE render queue and bringing it into Media Encoder and exporting from there.  In both locations, no matter what s

  • This adobe Muse site file is damaged and cannot be opened.

    This is a nightmare. I finished this website, went to go and update and got the message that the site file is damaged and cannot be opened. Are you serious? What can be done to get the file back, and how can this be prevented from happening again? I