insert a non printing character like xml tag character '['

Participant ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Hi All,

 

I need to insert a non printing character in a text box at caret position

so it would be great if somebody guide me how I could do this.

what area of sdk documentation/sample will help me.

 

Regards,

Alam

TOPICS
Scripting , SDK

Views

184

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Non printing characters are inserted when you use specific functions, like xml.

Others are shown with different spaces and breaks, when the user switches to show invisible characters.

What is the purpose and which one will you use?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Hi @alam_84, as @Willi Adelberger mentions it's hard to know what you need at this stage, but perhaps this little script will give you something to build on. It simply inserts an invisible character at the insertion point. You can pick any invisible character you like. I chose a zero-width-non-joiner.

- Mark

var zeroWidthNonJoiner = '\u200C',
    sel = app.activeDocument.selection;

if (
    sel.length == 1
    && sel[0].constructor.name == 'InsertionPoint'
)
    sel[0].contents = zeroWidthNonJoiner;

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Hi M1b your code works to insert a unicode non printing character, I looked into InDesign info panel to get unicode value for xml markup tag see attached screenshot and found its unicode value as FEFF but that does not work and instead of xml markup tag some other character gets inserted.  Can you help me to find correct unicode value for xml markup tag.?

tagMarker.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

FEFF is a Unicode byte order marker. It is invisible but should not be used in text except for its intended purpose and has nothing to do with XML tags, which as has been said are inserted with xml functions. As asked, please give more detail of your needs. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

My requirement is to insert xml marker character '[' at caret position and it should be non printable.

Does InDesign insert this xml marker as a character or graphic if it is a character then what is its unicode value and if it is a graphic then how it gets hide when doing print preview or pdf/jpg/xml export.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

You can't insert XML markers just like that, you'll have to use myText.markup(myTag). Which means that you can't simply insert an XML opening bracket/tag..

If you want a non-printing character you'll have to use one like Mike suggested, or maybe a text anchor.

Why do you insist on an XML marker?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

I need to create my own logic for custom tagging in such a way that symbol will remain [, ] but tag should not be added to xml structure. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

I think we are going to have a hard time understanding your exact needs here without some more specific info.

 

Could you post an example of what you want it to be like? For example, maybe something like this: "The quick brown[special_tag_1]fox jumps over[special_tag_2]the lazy dog" but you want the whole tag "[special_tag_n]" to be non-printing? And what about the xml structure? Tell us more. There might be a better way to achieve what you want, but I'm just guessing at this stage.

- Mark

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Hi Mark,

I have a panel which has list of tags (fetched from remote server).

Created a text frame having text "hello world abc"

Now I selected text world and select a tag from panel and click a button "Tag it"

And I want output as "hello [world] abc" where symbol '[', ']' should be non printing.

symbol might be a character or graphic but it should not shown while doing pdf/jpeg/xml export or print the document.

 

Hope above clear my requirment.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

I think my question is: if you don't want it to appear in your PDF, JPEG or XML export, nor the printout, in what sense do you want it to even BE in the document? I think you have a process in mind which finds these tags and does something with them - but since the tags won't be in PDF, JPEG or XML export - what will they be in and how will they be found?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Okay, well if I understand right, you are basically assigning a field from the remote database to a placeholder embedded in the indesign text, such that performing some kind of "update" action will update those values to match the latest remote values. If that is right, maybe have a look into using text variables for the placeholders? They have pretty good scripting support.

- Mark

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

text variables also insert printable character.

in short I need to replicate xml tagging behaviour in such a way that it insert marking symbol between the character/text range but should not add that tag to xml structure.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

text variables also insert printable character.

 

Sorry @alam_84, I don't understand this. Do you mean the contents of the text variable is printable? If so, yes of course: the text is printable. Or do you mean the text variable itself adds unwanted XML structure?

- Mark

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Yes Mark I mean content of text variable is printable but I want something that is mentioned by Laubender and Manan in their post. 

Thanks for your valueable reply now I need to check how text adornment can be show/hide.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

@alam_84 you don't just have to check how to switch on/off the adornment infact that would be the last of your concerns or probably not even a concern. The thing that you need to check is to create your own adornment, if you are thinking of using the existing XML adorment, I would advice against it as that might mess up with the tagging workflow natively present and who knows you might even not be able to do it. So the prudent way would be to have a personal adornment developed.

Also I would advice against using the same characters for your tag as used by InDesign because that can confuse the document user when using a document that has both your's and InDesign's native tags. It would also be confusing for you to debug.

-Manan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

How to add tonly ag marker in InDesign document without adding it in the "XML structure/Tag tree" and also the tag marker should be non-printing character.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Please don't open new posts when such posts already exist and are active. The other thread discussing this is

https://community.adobe.com/t5/indesign-discussions/insert-a-non-printing-character-like-xml-tag-cha...

Merging this with the other thread.

-Manan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Hi @alam_84 ,

what you described is what e.g. a plug-in like EasyCatalog is doing. It adds visble tags like an XML workflow would do, but the tags do not show in the tags tree of InDesign. So it can be done. However I do not know how it is done programmatically.

 

Regards,

Uwe Laubender
( Adobe Community Expert )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

The tag markers seem to be adornments. Adornment is somethnig that can't be created via the scripting interface so we need to dive into C++ SDK for it. I searched a bit, this is what I found.

  • The tag markers are probably implemented via kXMLMarkerAdornmentBoss
  • We probably would need to implement Global text adornments. These adornments can be switched on/off as per need something like we do for Showing/Hiding invisible characters, tag markers etc.

I haven't personally implemented text adornments so have no further insight on this matter as to how to go about implementing it etc.

-Manan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Thanks Manan, Your answer is helpfull to me now I just needs to check how these adornment can be turn on/off.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

LATEST

There is a nice sample plugin in the SDK

 

BasicTextAdornment.sdk

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Yes, your understanding is correct

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 21, 2022 Sep 21, 2022

Copy link to clipboard

Copied

Yes Laubender your understanding is correct.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines