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
Remotely collecting attributes (Read 3637 times)
Ted Goranson
Full Member
*
Offline



Posts: 141
Virginia Beach VA
Remotely collecting attributes
Nov 18th, 2009, 7:13pm
 
I suppose it is possible to have a note read a document at a url, parse some attribute data contained therein, move that data to actions and change attributes in notes?

The goal here is to have a comprehensive style guide for two folks working on two documents that should use the same methods.
Back to top
 
 
WWW TedGoranson   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Remotely collecting attributes
Reply #1 - Nov 19th, 2009, 5:28am
 
The built-in AutoFetch can pull RSS-type feeds or, using a runCommand() action with curl or the like, web/network accessible documents can be pulled into a note.

There is no auto-attribute-parse method, such as is offered when importing spreadsheet-like tab-delimited data. However, the note Explode command can be used to split out data. If the Explode build-in splits are too simplistic, use runCommand() to apply a command line/script to either the imported data or an explode of the same.  If you look at the thread here on textual analysis, you'll see a number of techniques discussed.  It's worth noting that if the texts are large and/or the scripts complex that performance may be less than instantaneous.

If an OS script could, in one go, use curl to find the source and then parse out and return an attribute value, then you could write action code like:
    $MyAttribute = runCommand("check-attribute.pl 'MyAttribute'");
...where a Perl script (outside Tinderbox, and which you'd need to write) takes the desired attribute name as a parameter and returns the value to standard output that runCommand then returns into Tinderbox to set the attribute value. It doesn't have to be Perl - it can be a command line, shell script, Ruby, Python, etc. Tinderbox could also access AppleScript via the command line though its seems shell scripts are faster and we're already communicating with the OS command line. [And, no I don't have any such scripts to hand!].

It's worth noting that the more formatted the source reference - assuming this is its main task (i.e. holding reference TB attribute values) then the more simply the reference is structured, the easier the script's task will be.

Do you have an example of the source data you might use? [note: I'm travelling for the next 24 hrs so I may not get to any follow-ups for a bit]
Back to top
 
« Last Edit: Nov 19th, 2009, 5:31am by Mark Anderson »  

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

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Remotely collecting attributes
Reply #2 - Nov 19th, 2009, 5:25pm
 
A nice -- and very simple -- way to do this is to store the value of each attribute you want to share at a unique URL. (This could be a static file or a cgi script or a RESTful database query, it makes no difference).

Then, use a rule or a low-priority agent to update the data.

    $MyAttribute=runCommand("curl http://example.com/path/note/MyAttribute".)
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print