How can I programmatically do what the "reset" button in "Edit Displayed Attributes..." does?

Hi - the subject says it all, really. I have a container with >300 notes. They all have the same structure (I imported them), but I cleaned it up a little by copying one, editing it and saving it as a prototype.
When I assign that prototype to the notes, they don’t change - I need to press the “reset” button in the “Edit Displayed Attributes…” popover.
How can I find a programmatic solution so I don’t need to do that manually to all >300 notes? I know it has to do with inheritance, and I read up on it, but didn’t find a solution. If there is none, I’ll do it manually, but I though I’d rather ask here to be sure…
Many thanks in advance for any help!

Wrong question. I mistook Displayed Attributes to $Text. Answer further below.

This a known feature request, and I don’t think there is an answer as yet. In part this is down the the inconsistencies of individual conception of reset (for the developer, if my and your conceptions differ, who is ‘right’? What to do?).

Part of the complexity is added , ISTM in the way ‘style’ is applied. To fully reset a note, I believe, oit is necessary to do two tasks:

  • first select all $Text (or you get different outcome form that you likely want).
    • menu FormatStyleStandard Font ( ⌃+⌥+⌘+T)
    • menu FormatStyleReset Margins. No shortcut!

Having done that more than once to doc with thousands of notes, I truly feel the pain, of the lack of such a reset. But, I also respect the problem posed .

But, once you want to—for instance—rest the fonts but not highlights, you need a far more nuanced control.

Style ruler are for me a retrograde step. Having (no obvious) per-paragraph styling bites me all the time, noting the need to use both Standard Font and Reset Margins to properly flush all not inherited settings. If I need this sort of typesetting, I can think of better places to do it; for me, in Tinderbox it simply gets in the way. But, I’m sure the lovers of styled text will think otherwise.

†. I never tried, but I do wonder it deleting all the the TBX’s <rtfd> tag data (i.e. the stored styled version) of text in a text editor—i.e. outside Tinderbox in something like BBEdit—might be a quicker fix. On opening I assume Tinderbox would rebuild the dat but with a lack of past data it would use the data in the <text> tag (i.e. the un-styled version of $Text) to start over thus being forced to build un-styled text beyond any inherited (doc or prototype) values.

Many thanks, Mark! Since the notes concerned only have attributes (no $Text in them), I am not sure your suggested steps help in my case.
I am far too timid to experiment with loading my file into BBEdit and doing something to its XML innards. So I’ll rather wait for some webinar that does not require my undivided attention and go through the (not very demanding) manual correction, I guess…

Understood. This is why a selection-level styling kill-switch would be a boon. If, as a user, I am over eager, well there are back-ups for that.

May you find a long but not-that-interesting webinar soon! :slight_smile:

2 Likes

When I experience this I take care of it in in two steps.

  1. Create a stamp:
    $Prototype=“pXXXX”;
    $DisplayedAttributes="";
    This will set/reset the note to the desired prototype and then reset the inheritance.
    I test this on one or two notes to make sure I’m getting what I expect.

  2. Select and apply the stamp to all relevant notes.

1 Like

Duh, I’ mixed $Test and $DisplayedAttributes. Re-setting the latter is much simpler. All notes inherit $DisplayedAttributes. The default is “” (i.e. nothing).

So, as @satikusala rightly advised test (and save a copy first before a mass change. Then use a stamp, or an agent that finds all non prototype notes and reset $DisplayedAttributes using the action:

$DisplayedAttributes=;

Now all notes will use a default or prototype-inherited value for Displayed Attributes.

@satikusala and @mwra, many thanks for your help - and combined it solved my problem! Michael, your stamp works perfectly, but I need to use Mark’s version of $DisplayedAttributes=; if I want to only reset, not delete the existing content of the attributes. Great! I hope others seeking a solution will find this in the forum. And I will add it to my “Tinderbox Tricks” file.

1 Like

Like @abusch I needed @mwra’s version to create a reset stamp. Quite helpful. Works perfectly. Now let me add my own curve ball to my task at hand. I’m in the third year of data collection for a qualitative research project. Things have gone well with Tinderbox so far, but I’ve hit a dual snag (this post solved the first issue). I’m collecting data in the Qualtrics Survey platform (a change from previous iterations of the collection phase), then downloading to a csv file, which I then import into Tinderbox. Qualtrics gives me a lot of unnecessary (for my analysis) junk and the stamp helps me dispense with the junk.

Here’s the rub: One field contains text that respondents have entered into Qualtrics (usually between 200 and 600 words). The text arrives in Tinderbox as a key attribute (along with 9 fields of numerical data stored correctly as key attributes). But I need the text that is currently stored as a key attribute to be real plain text in the accompanying text box. I know that I can copy and paste by right clicking on the key attribute to move text into the text box; however, I have over 500 data sets in one Tinderbox file from data I collected two months ago.

So, does anyone on the forum have a way (besides copy and pasting each entry) to move information (text field in my case) from the key attribute into the text box. Have I been clear enough?

If not, I’m still good as I only need to process about thirty files a week to distribute to my research team for preliminary coding. Thanks for at least thinking about my problem.

Exactly what attribute are you referring to? “Key Attributes” is a legacy term. If your text is in an attribute called $Abstract, for instance, all you need to do is create a stamp like this:

$Text=$Abstract;

This will move the value in $Abstract to $Text.

First, try it out with one or two notes at first to ensure you get the result you want. Once you are ready, you can then select multiple notes and apply the stamp to all of them at once.

I recommend you make a backup of your file, just in case you don’t get the result you want.

Also, it might help if you posted a small TBx with some example imported data in the ‘bad’ state and as you’d like it. that makes it much easier to test rather then merely suggest a solution. :slight_smile:

Perfect @satikusala. This did the trick. Nice when a simple solution solves a big problem. Thank you.

1 Like

Super glad I could help. BTW, let me take a few minutes to explain this operation.

In TBX action language, what we are saying is this:

“=” is an assignment rule
Let the left-hand side of an assignment be acted on by the value constructed by the operation on the right-hand side.

“==” is an equivalency test

So, in action code, if you write $Test=$Abstract what you are saying is make the value of $Text equal to the value of $Abstract. Similarly, if you say $Text=date(now)+" :"+ $Abstract what you are saying is make the value of $Text equal to today’s date plus a space, a colon, and the value of $Abstract.

Conversely, in action code, if you said if($Abstract!="") you are testing if $Abstract has a value, i.e., that it is NOT Emplty. TBX would return true or false. If you were to ask TBX then to take take an action on the result, you’d do something like this if($Abstract!=""){then this}else{that}, e.g. if($Abstract!=""){$Text=date(now)+" :"+ $Abstract}else{$Color="red"}. If $Abstract had a value you’d make $Text today’s date plus a colon plus the abstract; if it did not, you’d color the note red.

The transformative power of Tinderbox is unparalleled.

2 Likes

Thank you, I like the way you (@satikusala) can translate obtuse programming into [semi]-plain prose. It’s helpful to us who stumble along, learning just enough to do with Tinderbox what we need to do (until another obstacle raises its ugly head :thinking:). You can only imagine how many hours you’ve saved me with your brief answer here (already converted all 500 files to a usable form (and learned something about Tbx that I can file away for the future), For example, I need to have a unique ID for each of the 500 files. I decided to use the date field I received from Qualtrics (csv download) as a title and I can now easily slip the title into the text field while exporting for the research team. It’s quite an eloquent workflow that this little interchange helped me to see.

1 Like

BTW, if you need a unique note ID in TBX, that is already there. Every note has $ID. If you need one that associates with a source doc you can go with your data strategy.

Fabulous

Further to above, the ID attribute is described here: ID