0 Replies Latest reply on Aug 18, 2009 11:04 AM by jeffmlevy

    CS3 - Links & Text Replacement

    jeffmlevy Level 1

      Good afternoon.

       

      I'm not sure if I'm going about this the right way, but I'll describe what I'm doing, what I'm expecting to happen, and what's actually happening.

       

      I have two documents, 1.indd and 2.indd.

       

      Document 1.indd has some simple text in it, [[first_name]], [[last_name]]

       

      Document 1.indd was "Place[d]" into document 2.indd. It shows up in the links list, and all is groovy. Document 2.indd has it's own seek/replace keys, [[first_name]], [[last_name]]. More on this below.

       

      When I render my document, I see document 2.indd layout, text, images, etc, and as if by magic, I see the content from document 1.indd, [[first_name]], [[last_name]].

       

      Now, for some background on [[first_name]] and [[last_name]]. I use various calls to changeText() in my jsx to do seek/replace.  The [['s are just placeholders that I use to seek on, and then I replace the 'first_name', 'last_name', or whatever. My system has been working for quite some time. I'm sure there are other means of doing seek/replace, but this one is working for me.

       

      Anyhow. To the meat of the matter...

       

      My seek / replace is working Great on document 2.indd. When I pass my hash of seek/replace pairs, the [[first_name]], [[last_name]] turns into "Joe" and "User", respectively. Great. BUT, the Placed "link" of 1.indd, still shows [[first_name]], [[last_name]].

       

      Odd.

       

      First and foremost, I'm pleased that InDesign server is including the links by itself. I make no calls to place 1.indd in my jsx, it's just magically "there".

       

      When the substitution failure I mentioned above happened, I assumed that InDesign had lost track of link 1.indd. I wrote a quick check and no, InDesign shows a "normal" status on that link. Perfect.

       

      So why then does my changeText() fail? My guess is that it's because the [[first_name]], [[last_name]] placeholders are part of a different document. IE: They're not actually part of the Document object for 2.indd, they're really part of the "linked" 1.indd, so, any call to document.changeText() simply wouldn't work.

       

      My next trick was to create a quick temporary var based off of the filePath attrib of link 1.indd, thus:

           temp_doc = app.open(File(myLink.filePath));

           // then:

           temp_doc.changeText(); // ... etc etc.

       

      No. This didn't work either. Hence, why I'm here asking for help.

       

      I'll post this now, and hope It captures someone's attention. If there are more details I can provide, by all means, inquire and I will provide more.

       

      Thanks!