Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Trying to move a note using $Container (Read 6698 times)
Michael Fremont
Full Member
*
Offline



Posts: 33

Trying to move a note using $Container
Sep 23rd, 2009, 11:25am
 
I've written an agent which looks for notes with a certain attribute and then moves them:

query: (Tags(tbug)) & ($Container != "/Tinderbox/tBugs")
action: $Container="/Tinderbox/tBugs"

(ok, I admit it, I'm gathering bugs to report - but, full disclosure, I think Tinderbox is fantastic)

Instead of moving notes, it's creating aliases in the new location, and making infinite numbers of them! (the query never goes false, since the note never moves).

This is not the behavior I think is described here: http://www.acrobatfaq.com/atbref46/index/Attributes/SystemAttributeList/Containe...

Strangely, if I change Tags to $Tags (as suggested here:
http://www.acrobatfaq.com/atbref46/index/AgentQueries.html

then the agent doesn't match anything at all.

Possibly related, the other day I made an alias of a note in a map (using cmd-L), cut it, went to another place in the hierarchy, and pasted it - and landed up with a same-named copy of the original note, rather than the alias I had cut.

Am I massively misunderstanding stuff here?

Thanks,

Mike
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Trying to move a note using $Container
Reply #1 - Sep 23rd, 2009, 11:43am
 
In an agent action, "this" refers to the alias gathered by the agent. So, if your agent turns things red,

      Action: Color="red"

the alias becomes red, and hence the original note becomes red, too.

For some attributes, though, changing the alias doesn't change the original.  For example, if we set $Xpos of an alias, we don't want the original to move!  Same thing for $Container; the alias's container is not the original's container.

    $Container(original)="/Tinderbox/tBugs"

This subtle distinction arose fairly recently -- older versions of Tinderbox just changed the properties of the original note.  But this made some sensible kinds of HTML export tasks more difficult than necessary, and the additional argument to $Container isn't really onerous.

Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Trying to move a note using $Container
Reply #2 - Sep 23rd, 2009, 12:19pm
 
@Michael, re the second aTbRef reference - I think you've understood the meaning of a $ prefix in the context of a query. So:
  • $Tags(tbug) tests the Tags attribute values for a single note caled 'tbugs' against a value you supply - or defaults to testing if the attribute holds a value at all; no value equates to false, i.e. no match. If more than one note is called 'tbug' - or whatever supplied name - TB matches against the first note in outline order resolving to that path/name.
  • Tags(tbug) searches all notes for notes whose Tags attribute contains the string 'tbug'.
Different things - so unsurprisingly you get different results. It is worth getting used to the $-prefix and using it correctly as in some future version TB will stop guessing whether you mean $Tags(path) or Tags(regex pattern) when you type Tags(something) in queries. Good incentive to learn the new syntax 'rules'.

As a rule of thumb, you should now always $-prefix a tag name, in action code, except if in a query or if(condition). In the latter two contexts you have the choice of using the alternate regular expression matching method by leaving off the $. The $-prefix is not used in export code - if you do use it there you may get unpredictable results.
Back to top
 
« Last Edit: Sep 23rd, 2009, 12:20pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Michael Fremont
Full Member
*
Offline



Posts: 33

Re: Trying to move a note using $Container
Reply #3 - Sep 23rd, 2009, 12:46pm
 
OK, first I have to say, I can't believe how good the support here is!  I was preparing to reply to Mark B's extremely fast reply, and then found Mark A had chimed in too!  Wow.

MarkB: I get what you are saying, thanks.  So I can better understand how to do things, and not bother you, where can I find documentation that describes this kind of behavior?  Looking again at the reference page, I don't see it; but I do see language that implies differently:

"Also all references to attribute names should be prefixed with a $ character."

Please don't take this as any kind of criticism!  Documentation is hard, this is detailed stuff,  time is short, lots of things to do!

Best regards.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Trying to move a note using $Container
Reply #4 - Sep 23rd, 2009, 1:55pm
 
Ah, the joys of English! I was perhaps using Reference in a narrow context without flagging it clearly.  By 'reference to an attribute' I mean to refer to the value of that reference as opposed to testing the value via regular expression. That's why I say you should now always use a $ prefix except where you specifically wish to do a regexp test.  As that's only one type of use where a $ isn't used, it's that simple. Get used to asking yourself "where don't I use use a $?" rather than the opposite way about which, I grant, for many is the more intuitive question.

The next tripping point is that action code uses the $ notation but export code (older, and also being scaled back) doesn't know/understand the $ bit.

The real problem is that the non-$-prefixed AttributeName(regex pattern) code syntax is both succinct in form and a very early usage in TB's history, if it's changed a lot of folk will doubtless get out of sorts. Personally, I wish we could ditch that syntax and have something like test($FirstName, "ar") or match($FirstName, "ar") which would replace FirstName(ar) as a way to look for note's whose $FirstName contains the character sequence "ar", e.g. as in "Mark" or "Richard". I guess that's a feature suggestion!

Formal documentation in this area is lagging right now, not least as it's difficult to document transitional processes. Plus,  right now, the users' clamour is for Unicode and Universal Binary support; time for documentation re-write is the bit that has to give. Meanwhile, I'll see if I can't make aTbRef's description of this area less ambiguous.
Back to top
 
« Last Edit: Sep 23rd, 2009, 2:00pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Trying to move a note using $Container
Reply #5 - Sep 23rd, 2009, 2:01pm
 
I think http://www.acrobatfaq.com/atbref46/index/Attributes/Attributes-$prefixnotati.htm... is the bast place to start researching $ notation. As I say above, for action code $ prefixing is the only correct current usage except for when regexp matching.
Back to top
 
« Last Edit: Sep 23rd, 2009, 2:04pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Michael Fremont
Full Member
*
Offline



Posts: 33

Re: Trying to move a note using $Container
Reply #6 - Sep 23rd, 2009, 2:25pm
 
Excellent!  I now understand, I think, pretty fully.  

I also like your suggestion for a clearer match syntax - but I understand users' clamor!

Do you know why this (mentioned earlier) happens to me?  Is it another misunderstanding on my part?:

"...the other day I made an alias of a note in a map (using cmd-L), cut it, went to another place in the hierarchy, and pasted it - and landed up with a same-named copy of the original note, rather than the alias I had cut."


Thanks again for your remarkable help.
Back to top
 
 
  IP Logged
Michael Fremont
Full Member
*
Offline



Posts: 33

Re: Trying to move a note using $Container
Reply #7 - Sep 23rd, 2009, 3:11pm
 
Mark (whichever runs the forum), a request:

The forum is very valuable, it has tons of great info.  I use search a lot to find stuff on it.  Can the limit of 15 search results be lifted?  I'm constantly hitting against the limit, so it's considerably less effective.

I'd narrow my search, but of course it's often true that the gems are hidden and you don't know exactly which search terms will find them... unless your search is somewhat general!

Thanks for your consideration.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Trying to move a note using $Container
Reply #8 - Sep 23rd, 2009, 3:23pm
 
Annoyingly search pages don't paginate. So, to balance content vs. usable pages I've changed the number of search results from the default 15 to 45. That should give you a bit more scope.  
Back to top
 
« Last Edit: Sep 23rd, 2009, 3:24pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Michael Fremont
Full Member
*
Offline



Posts: 33

Re: Trying to move a note using $Container
Reply #9 - Sep 23rd, 2009, 7:38pm
 
Beautiful, thanks!
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print