Reply to topic  [ 4 posts ] 
Text Boxs? 
Author Message

Joined: 2013-05-03 07:06:31
Posts: 103
So I read the macro language docs; searching for information on text boxes. It appears we can create a text box, and even position it (can we link it to a paragraph though?), but actually linking the text boxes together--is that possible? There appears to be very little available, and the menu commands don't actually let you link text boxes--they only start the linking process but you have to use the mouse to link the boxes, correct?


Second, is there a way to make hidden or invisible text, somehow? I'm thinking of putting in some tokens that I can find; but I don't want them visible. I think RTF has that ability, but can Nisus actually make text invisible or hidden?


2016-05-28 12:51:00
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Hello Vanceone,
the answers to your questions are not going to be very satisfying, I suppose.
  • You can manipulate text boxes—move them, change their appearance, change their contents, etc.— but you can't really create them. But if you do have one already, you can use it to create new ones. I used this once to create a macro that made "running" headers (as in a dictionary). [See here]
  • You can't control linkage of the text objects of text boxes. If you check the text objects of linked text boxes they will just return the same text object. You won't even know which text box is first, second, etc. If you have a text object of documentContentType "textbox", you can't directly retrieve the textbox (i.e., floatingContent) object associated with it.
  • Nisus doesn't have any hidden/invisible text. Depending on the needs you might be able to use the following types of work-arounds: white color text (on white background), perhaps in a small size or on a line with very small line height, or otherwise use comments. White color text has the drawback that it still requires space, and only works if it fits the background color. Comments might interfere with other uses.

_________________
philip


2016-05-30 02:11:33
Profile

Joined: 2013-05-03 07:06:31
Posts: 103
This is unfortunate. I wonder if something can be done with raw RTF codes? Which leads me to wonder why NIsus hasn't implemented the hidden rtf code, or /v command. I know Cocoa's RTF interpreter doesn't read it, among others, but you can extend the attributed string class (I assume Nisus uses NSAttributedStrings for most work here) to handle more of the RTF spec.

I wanted hidden text to implement some parsing code, as tags or field codes, really. We don't have user definable field codes, or a way to mark the text. Nisus can, clearly, as it marks index text. But I wish we could mark text in a way that will persist to disk (I cannot imagine that we can save selections? I note that the macro docs suggest that we can save a set of selections temporarily on a stack, for instance, and restore the selections, but I don't think we can persist it).

Also, there's no way to have a macro automatically run based on events, is there--like "run this macro upon document open" for instance. Or on save?


2016-06-02 07:02:51
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Nisus Writer doesn't have a way for you to manipulate field codes using macros, though it does support them. For example, here's an ugly macro that uses RTF to apply a field code to the selection:
Code:
$text = Read Selection
$rtf = @String<{\rtf1 {\field {\*\fldinst MY FIELD CODE}{\fldrslt {$text}}}}>
$text = Decode RTF $rtf
Insert Attributed Text $text

However, I wouldn't recommend that approach. Not only because there's no good way for your macros to introspect the field codes, but also because RTF munging in a macro is going to get ugly fast, especially if you want to preserve formatting, etc.

What about using named bookmarks for your purpose? Bookmarks can mark and span arbitrary text, and the bookmark's name could encode the information you want to track.

Quote:
Also, there's no way to have a macro automatically run based on events, is there--like "run this macro upon document open" for instance. Or on save?

That's correct, this is not possible. However it's been requested, so I'll add your vote– thank you. I've also made sure to file or upvote your other suggestions.


2016-09-21 15:40:22
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software