CS3 JS create textFrame with label then change content at a later stage.

Is it possible to select a textframe by label?
Here is a simple script which creates 2 text boxes labeled JSLabel and JSLabel2.
var myDocument = app.documents.add();
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
myTextFrame.contents = "Hello World!";
myTextFrame.label = "JSLabel";
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["8p", "8p", "24p", "24p"];
myTextFrame.contents = "Hello World Again";
myTextFrame.label = "JSLabel2";
Here is a script you can run at a later stage to change the content of JSLabel textframe.
if (app.activeDocument.textFrames[1].label == "JSLabel"){
var mySelect = app.activeDocument.textFrames[1];
app.select (mySelect);
mySelect.contents = "Text has been changed.";
Rather than using if (app.activeDocument.textFrames[1].label == "JSLabel") can I just select the textframe labeled JSLbel and change the content?

Just bear in mind that if you have multiple frames with the same label, they'll all be affected if you set the content.
Dave

Similar Messages

  • [AS] CS3- Find any text with style, then replace that text with a new applied fill color.

    I am trying to find the simplest way in cs3 to find any text with style, then replace that text with a new fill color. I can find text and change text. I can find a style and change it to a new style. I can't seem to find a style and change the applied fill color. I do not want to change the properties of the style, just the applied color. Yes, I want the + sign, for now. I know, why not update the style, I am not allowed to. Any help would be great. Since the search is not available, I need a new response.
    Thanks.

    You can work around the bug by just doing a find, then looping through the<br />results, changing the color one at a time. It'll be a fraction slower, but<br />should do the trick:<br /><br />tell application "Adobe InDesign CS3"<br />    set find text preferences to nothing<br />    set properties of find text preferences to {applied paragraph style:"The<br />name"}<br />    set theFinds to find text document 1<br />    repeat with i from 1 to count of theFinds<br />        set properties of item i of theFinds to {fill color:"Replace color"}<br />    end repeat<br />end tell<br /><br />The bug is fixed in CS4, BTW.<br /><br />-- <br />Shane Stanley <[email protected]><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>

  • Form login with java, then change URL

    this is my problem, theres a site where I need to login with a login + pass. now when I try to take a new url (on the same host) I'm back at the login page, so basically I want to login, and then keep that login to parse several pages on the server... I didn't write this code myself, but it works for the login :p now I just need to change the url in the same connection I guess
    String argus[]= {url,"name",name,"password",password};
              URL u = new URL(argus[0]);
              String postdata = URLEncoder.encode(argus[1]) + "=" + URLEncoder.encode(argus[2]);
              for (int i=3;i+1<argus.length;i+=2) {
              postdata = postdata + "&" + URLEncoder.encode(argus) + "=" + URLEncoder.encode(argus[i+1]);
              URLConnection uc = u.openConnection();
              uc.setDoOutput(true);
              OutputStreamWriter out =
              new OutputStreamWriter(uc.getOutputStream(),"ASCII");
              out.write(postdata);
              out.close();
         String s;
              while ((s = r.readLine()) != null) {
              System.out.println(s);
    so far it works perfectly, but now I need to get another html page on that server, but when I create a new URL it goes back to the login page...
    any ideas ?

    The page probably sets a cookie. This article tells about one way to handle cookies:
    http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-cookie.html

  • Run .sh script with Java, then change window position

    Is the following possible?:
    From java, run a .sh script, which opens a total of 4 windows. (I know how to do this part).
    Once the 4 windows (or more) are opened, I want to position them in specific locations on the screen. Is this possible, since the .sh script actually opens the windows?. Use the setLocation method in java.awt.Component??
    any help is appreciated.
    thx

    As I recall, -geometry can have 4 numbers, I think it was {width}x{height}+{X location}+{Y location}, for example "-geometry 400x300+20+20". The + signs can be - signs if you want to count from the right or bottom margins.
    Yeah, here's a quote from "man X":
    most X programs accept a command line argument of
    the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF,
    and YOFF are numbers) for specifying a preferred size and location for
    this application's main window.
    Check out the man page for more details.

  • When importing XML, how do I remove lines with labels but no content?

    I am working on a directory whose content is supplied as an XML file. I've created an automatic layout with static text/labels for contact details (e.g. Phone, Fax).
    When I import the file, superfluous lines with the static text and no content are created. I have 'Delete elements, frames and content that do not match imported XML' checked.
    Is there a way of avoid creating these? I've tried doing a search and replace to remove these but this causes quite a few other problems.
    Any help - much appreciated!

    Hi Alison,
    Did you create the posted XML file by extracting it from a larger file you've been using successfully? I ask because there seem to be a couple of problems with it which make me wonder how you got it to work at all, at least with the provided InDesign file's XML structure:
    The immediate child element of the "root" element in the XML document is one called "step2 ". All of the values with which you are concerned are children of that "step2" element, and yet the structure in the InDesign document contains no "step2" element. As a result, when I import, I get nothing at all in my InDesign document's content (though the data are in the XML structure, buried in a newly-created "step2" element.
    In both the XML and the InDesign document's XML structure, you have two different elements which are both named the exactly the same - "description" - (actually, in the XML document, there are three of them). When InDesign imports XML, it stops after the first "match" that it finds, so this will not work in any way that I imagine you intend it to. Based on the content of your InDesign document, I would think there ought to be two separate elements in your XML - named something like "step_description" and "category_description".
    If, after getting this all straightened out, your question is how to somehow make the text of an empty element (e.g., <description></description>) disappear in the imported result, there are a few possibilities:
    Get rid of the text inside the tag markers in your template/base document - for example, instead of having "[step_description]" (where the "[]" represent the tag markers), just make it be "[]". That way, if there is no text value for "step_description", there will be no text left after the import. However, if you put a end-of-paragraph in your template/base file, that will still be there. In most cases, that's not desired, so you might want to put the empty tag ("[]") in the text flow without a carriage return/line break. If you do that, you will need to include the carriage return in the XML data (which admittedly slightly violates the notion of separating presentation from content). Rather than the xml looking like this:
    <step_description>This is the text of my step description.</step_description> you would need to make it be this:
    <step_description>This is the text of my step description.&#13;</step_description>
    (having added "&#13;" to represent the carriage return (ASCII character 13).
    As above, make the tag an empty one, include the carriage return in your InDesign template/base document, and then write (or have written) a script to run after the XML import to deal with such empty tag cases.
    Upgrade to InDesign CS3, CS4, or soon, CS5, so you can take advantage of the "XML Rules" feature which was introduced in CS3. XML Rules will essentially allow you to automate the second option - running a script - as the XML import is taking place.
    Excuse the long (and probably unclear) post. If I've misunderstood your question, then please excuse it doubly...

  • Problem with layout and changing content

    Hi, I`m new to Swing and I have a problem with layout.
    I want to make a menu using JButtons so that depending on which button you click you`ll get different content in the window. And first of all I don`t know how to center the buttons.
    I have a JFrame called GameWindow that has a JPanel field called content. My idea was to create a JPanel with buttons and then using ActionListeners change the JPanel held in 'content'.
    Here`s the code:
    public class GameWindow extends JFrame{     
         private static final long serialVersionUID = 1L;
         private JPanel content;
         private Player player;
         public GameWindow(){          
              super("Dawn Crystal");
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              setSize((int)screenSize.getWidth(), (int)screenSize.getHeight());
              setExtendedState(MAXIMIZED_BOTH);
         public void mainMenu(){
              content = new MainMenu(this);
              Dimension dim = content.getSize();
              setLayout(null);                    
              Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
              int x = (int)((screen.getWidth() - dim.getWidth()) / 2);
              int y = (int)((screen.getHeight() - dim.getHeight()) / 2);
              int dimX = (int)dim.getWidth();
              int dimY = (int)dim.getHeight();          
              content.setBounds(x, y, 120, 120);          
              getContentPane().add(content);          
              setVisible(true);
         public void adventureScreen(){
              //so far empty
         public void createNewPlayer(){
              content.setVisible(false);
              content = new NewPlayerCreationWindow();
              getContentPane().add(content);          
              content.setVisible(true);
              //setVisible(true);
         public void setPlayer(Player p){ player=p; }
    public class MainMenu extends JPanel{     
         private static final long serialVersionUID = 1L;     
         private JPanel mainMenuButtons;
         private JButton newGame;
         private JButton loadGame;
         private JButton options;
         private JButton exit;
         public MainMenu(GameWindow par){
              mainMenuButtons = new JPanel();     
              //create buttons
              newGame = new JButton("NEW GAME");
              loadGame = new JButton("LOAD GAME");
              options = new JButton("OPTIONS");
              exit = new JButton("EXIT");
              //create action listeners
              newGame.addActionListener(new NewGameListener());
              exit.addActionListener(new ExitListener(par));     
              //add buttons to panel
              mainMenuButtons.setLayout( new GridLayout(4,1));
              mainMenuButtons.add(newGame);
              mainMenuButtons.add(loadGame);
              mainMenuButtons.add(options);
              mainMenuButtons.add(exit);     
              add(mainMenuButtons);          
    }When it displays the buttons are at the top of the frame rather than in the center - I thought that was how the default layout would behave. So that`s my first question - how to center it.
    Secondly I have NewPlayerCreationWindow written but when I call createNewPlayer() I get an empty frame - what am I doing wrong?
    Finally I`d like to ask how can I make the frame appear as maximized when the application is started? The setExtendedState(MAXIMIZED_BOTH); doesn`t help actually because the window`s height is too big and a part of window is hidden under the system bar. I want to have it maximized regardless of screen resolution.

    Use a [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]Card Layout.

  • Creating documents with SCMS_DOC_URL_CREATE in SAP Content Server

    Hi there,
    I have a Problem here  with the Knowledge Provider concerning SCMS_DOC_URL_CREATE and hope anyone could help me out.
    For a SAP Records Management document I am calling BAPI_SRM_DOC_CREATE and get a LOIO and a PHIO ID for my new document. The PHIO-ID I pass to SCMS_DOC_URL_CREATE which then creates the URL to put the file on a SAP Content Server with a 3rd party tool. That works totally fine and I can see the file on the Content Server with its metadata,
    Unfortunately SAP Records Management doesn't recognize that a file has been uploaded. When I open the file in the transaction ORGANIZER it has no content and no components.
    Is there any function call I am missing to tell the Records Management document that I have uploaded something?
    All is working fine when I get the uploaded content into NetWeaver with SCMS_GET... and call BAPI_SRM_CHECKIN_DOCUMENT. But of course this is not what I want (transferring the file directly in the local network area where the content server stands, then getting it back to NetWeaver and back again to the content server).
    Any help would really be appreciated.
    Thank you
    Marcus

    Answer: because SCMS_DOC_URL_CREATE is not remote enabled by default.

  • Loosing changed contents when used FM REUSE_ALV_GRID_DISPLAY

    Hi,
    I have used FM REUSE_ALV_GRID_DISPLAY in my program as below.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = g_repid
          i_callback_pf_status_set = c_pf
          i_callback_user_command  = 'USER_COMMAND'
          is_layout                = ist_layout      "I_CALLBACK_TOP_OF_PAGE = C_TOP
          it_fieldcat              = ist_fieldcat
        TABLES
          t_outtab                 = ist_outtab.
    and kept one column editable by setting EDIT = 'X' and INPUT = 'X' for one column in ist_fieldcat.
    Now if user changes contents of a cell in this editable column and clicks on any toolbar button, then changed contetns are not received in USER_COMMAND routine.
    But if user changes the contents of a cell in this editable column and then double-clicks anywhere inside the ALV grid, then changed contents are received in USER_COMMAND routine.
    I dont want to loose the changed contents of ALV grid, can anybody help in this.
    Thanks in advance.
    Regards,
    Dhiraj

    In your USER_COMMAND form check the SY-UCOMM  for button which you have pressed may be you have used '&IC1'  (for double click)
    provide your Form USER_COMMAND code here.
    Kanagaraja L

  • If I change the nation setting of my iTunes in order to buy a song from the American iTunes store, then change my setting back to the Korean store (where you cannot buy music) will that create any problems with my downloaded content?

    If I change the nation setting of my iTunes in order to buy a song from the American iTunes store, then change my setting back to the Korean store (where you cannot buy music) will that create any problems with my downloaded content? I want to buy an album that I cannot get hold of in Korea, but it is available in the US iTunes store. However since most of my apps are downloaded from the Korean store I'll need to switch back in order to update them. Does anyone know if there are any issues in doing this. I'd rather find out before I spend money, change my store setting back to Korea, and then get told I can't listen to the music because I bought it from the US store and my iTunes is set to the Korean store.
    Cheers.

    You canot easily change your country settings.  The iTunes Store in a country is intended only for use by that country's residents, and only while they are in the country. To use the iTunes Store in a country you need a credit card (or other card type if acceptable in a country) issued in that country, billed to an address in that country, and also be physically present in that country when using the store.  You are also restricted to waiting 90 days between country changes.
    E.g., "The iTunes Service is available to you only in the United States, its territories, and possessions. You agree not to use or attempt to use the iTunes Service from outside these locations. Apple may use technologies to verify your compliance." - http://www.apple.com/legal/itunes/us/terms.html#SERVICE

  • I create an apple id then i want to verify it, i verify it once then  when i log in with my apple id it asked mi again to verify it.everytime i log in it asked me to resend verication and after i resend it i press done. Please can anyone help me ?

    I create an apple id then i want to verify it, i verify it once then  when i log in with my apple id it asked mi again to verify it.everytime i log in it asked me to resend verication and after i resend it i press done. Please can anyone help me ?

    How are you verifying it?  Are you responding to the email that is sent?  If not, do so.
    If so, then try changing your password.

  • With my iphone 6 with ios8 I need a new way to create custom contact labels via Apple or  app

    How can I create custom contact labels on my iphone 6 using ios  8?

    I assume you mean in contacts you want to add a custom label, not print a label as FoxFifth suggested!
    Todo this click edit on the contact, then click the name of the field you wish to rename (there should be a red circle with a minus beside it)
    A list comes up and at the bottom you can click "Add Custom Label" and type in the name.
    Please note this doesn't work with Exchange servers

  • Universally replace one character with another and then change font

    Hello,
    I have a geologic map file where there are hundreds of labels like Cc, Cz, Cwu, etc... all in the Arial font. I need to change all of the capital C's with a character from the StratagemAge font. That is to say, I need to find all instances of one character in my file and then replace them with another character and then change the font of that selected character.
    I've been trying to figure out how to write an action to do this, but I was wondering if there is a way to do this easily already.
    Any suggestions?
    Jeremy

    > how do you turn off the dialog for the Find/Replace in action palette?
    At the left of each Action step is a square field. Mouse over it and the tooltip will read "Toggle Dialog On/Off".
    > I got an action that I wrote to work, but it takes a button click for each instance in my file that I want to change. Would yours have that same drawback as that?
    Yes, you would have to click each time to run the Action (or, you could assign a function key), but there would be no dialog to dismiss.
    But you can pile several iterations of the same steps in the Action; so that one execution of the Action does ten replacements with one click, for example.
    This would not be a particularly difficult thing to Javascript, but you are correct that scripting has a learning curve. This task is not something I would think often needed. Doing a few hundred replacements in a file, using an Action would not seem overly burdensome to me. But if it is a recurring need for you, it might be worth writing a script.
    JET

  • Have family plan with 250 data which I almost use each month.  Going on vacation and will be on the road for two weeks.  Should I up my data for a month then change back.  Is it worth it or should I just run over and pay the extra 15 per gig?

    have family plan with 250 data which I almost use each month.  Going on vacation and will be on the road for two weeks.  Should I up my data for a month then change back.  Is it worth it or should I just run over and pay the extra 15 per gig?

    Hello mlazaretti. Vacation time is awesome. (Especially a road trip!) Since you will be going out for two weeks, you never know if having extra data may come in handy. I highly recommend switching to the next tier up so this way you have more data. This way it is only $10.00 more versus $15.00, and you dont have to worry about overages. Then change back at the start of the next billing cycle.
    If you need help making this change let us know! Have a safe trip!
    NicandroN_VZW
    Follow us on twitter @VZWSupport

  • I have a new email address. Changed this on my itunes account. On iPhone deleted old icloud account and created new with new email. I have set find my phone to on. When I download music it no longer goes to icloud an does not show up on my iphone.

    I have a new email address. Changed this on my itunes account. On iPhone deleted old icloud account and created new with new email. I have set find my phone to on. When I download music from itunes it no longer goes to icloud an does not show up on my iphone.

    I have the same problem - it is maddening. I rely on this iPad for work so this is not just an annoyance! The above solutions of changing the appleid on the device or on the website do not work.
    The old email address no longer exists - I haven't used it in a year probably and I no longer have the account.  I logged into the appleid website and there is no trace of the old email address so there is nothing that can be deleted or changed there.  On the iPad there is no trace of the old email address so nothing can be deleted there either. I have updated the iPad software and the same problem comes right back.  Every 2 seconds I am asked to log in using the old non-existent email.  The device is currently useless.
    The only recent change to anything was the addition of an Apple TV device, which was set up using the correct login and password.
    Does anyone have any ideas? The iPad has been backed up to the iCloud so presumably it now won't recognize the current iCloud account? So restoring may notbe an option?

  • I have Dreamweaver CS3 on a PC with Windows Vista SP2. The program recently began to hang when opening previously created HTML files. How do I fix this?

    I have Dreamweaver CS3 on a PC with Windows Vista SP2. The program recently began to hang when opening previously created HTML files. How do I fix this?

    Hi rmarchione,
    Can you try restoring preferences and let us know if it helps?
    Restore preferences | Dreamweaver CS4, CS5, CS5.5, CS6
    Thanks,
    Preran

Maybe you are looking for

  • IMac Memory slots

    I keep getting confused on how many slot there are total, so my question is, how many total memory slots are in the new intel iMac 24"?

  • Cost stored in tables MEK3 ,ME13 AND VK13

    Hi All Can you please give me the tables and fields for the cost stored in t-CODES MEK3 ,ME13 AND VK13 regards sandeep kumar

  • Where is text properties panel?

    In Dreamweaver 8, when I highlighted a word or text, there was a properties panel at the bottom. In that panel I could set or change format, font, style, size, color, bold, italic, align left, align right, align center, justify, set a link, and set a

  • I cant download premiere elements 11 from my account

    I receiwe this error!!

  • Discontinued vs Continued by manufacture

    I have an ipod 4th gen 8gb and it has been in a critical condition ever since last year (November 2014) and I think fixing it now is a bit of a waste of money due to the new product updates. I have many great songs in my ipod that I would not want to