Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Change Text Fram to Unassigned

Return to Member Forum

  • Author
    Posts
    • #56007
      jrowley
      Member

      I'm new to scripting and I'm about to pull my hair out. I almost have it doing what I need but I cannot figure out one last thing:

      I'm at a text-level object and have just deleted the text in the text frame. Now I need to get javascript to jump up the hierarchy to the containing text frame, and then convert that frame to an unassigned fame so I can apply Teacup's BarcodeMaker plug-in.

      How do I get to the parent frame (InDesign tells me that myVar.parent can't take the .parent)? And then, how do I convert it to an unassigned frame?

      Thanks

      (nearly-bald from pulling my hair out over this) Joe

    • #56010

      Your myVar parent might point to something quite else; my Help lists “The parent of the Text (a XmlStory, TextPath, TextFrame,Text, Character, Word, Line, TextColumn, Paragraph,TextStyleRange, InsertionPoint, Story, Cell, XMLElement, Footnote, Change, Note or HiddenText).” — in reality, I've rarely seen anything else than simply “Story” or “Cell”.

      A good way to debug this kind of stuff is to check what InDesign thinks myVar and its parent are:

      alert (myVar.constructor.name+” / “+myVar.parent.constructor.name);

      You can always try myVar.parentTextFrames[0] — this will point directly to the frame holding your text.

      Theoretically, you ought to be able to change the contentType of a frame's properties from TEXT_TYPE to UNASSIGNED, but I remember having wrestled with this before. It might be ID simply does not believe you when you want to change the type of a Text Frame

    • #56011

      I might as well throw this in: I think both Adobe's ExtendScript Editor and its novelty “Help” viewer blow, big time! I use TextPad on the PC, TextWrangler on the Mac. Wot — then you don't have access to the Help? Luckily, I found all the text of the Help files is stored into a single *huge* XML file, and using an XSLT transform I was able to convert all of it to a coherent set of HTML files, and compile that again — an idea of fellow scripter ABC GREEN — into a Windows CHM Help file, getting indexed and full text search for free!

      I also added loads and loads of extra hyperlinks, and an incredibly useful — if you don't mind me saying so :-) — hierarchical view per object. That's how I can tell right away what parent-child relations are for all classes. The XSLT transform file is 2490 lines, at present…

      You can download either HTML or CHM sets, for CS3, CS4 or CS5, from my site: https://www.jongware.com/idjshelp.html

      The Windows CHM version is the most user-friendly. On Windows, you don't need anything else; for the Mac, you need a CHM viewer (I use Robin Lu's iCHM For Mac — https://www.robinlu.com/blog/ichm –, it's almost as good as the Windows help but much easier on the eyes :-D ).

    • #56013
      jrowley
      Member

      Thanks for the help. I'm still fighting through this, but now I feel like I'm headed in a good direction.

      I found that the parent to the story is the document itself. That's why I couldn't do anything with it! I'm so close that it's frustrating me that I can't figure it out, but I think I'm headed in the right direction.

      Although I have had some experience with PHP (minimal), this is only my second venture into javascript and learning on deadline is not the way to go.

      I'll check out those files becasue I agree — I can't make heads or tails of half of the help file.

      thanks again for the help.

    • #56101
      Harbs
      Member

      @Jong:

      You are only going to have a Story, XMLStory, Footnote, Note, or Cell returned for the parent property of text. The “parent” listings are a more liberal definition of parent. It's any object which contains the text in its properties, rather than the strict parent of the text…

    • #58886
      ethren
      Member

      Hello,

      How did you fair? Sounds like the same solution I am looking for. Any interest in sharing :)

      I'll understand if you say no. I'm sure a lot of work went in to it.

      Cheers,

      Thomas

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads