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
default paths (Read 6350 times)
james a. foster
Full Member
*
Offline



Posts: 130

default paths
Nov 19th, 2011, 11:23pm
 
Any suggestions on how to set default paths in TBX for things like external scripts? I'd like to develop some Python or Perl Parsers just once, and have different collections access them.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: default paths
Reply #1 - Nov 20th, 2011, 8:46am
 
Currently, we simply use your default PATHs.  That seems straightforward; if you want to change your PATH, UNIX and Mac OS X give you plenty of oppportunities.

But we *could* also modify PATH for runCommand, perhaps to add a designated directory

    ~/Library/Application Support/scripts/

to the standard PATH.  Or we could add an attribute $CommandPath that would apply to a specific note's actions.

These raise interesting questions of Unix idiom and environmental variable hygiene. Suggestions and comments welcome.

(This should probably be moved into Feature Requests)
Back to top
 
« Last Edit: Nov 20th, 2011, 8:46am by Mark Bernstein »  
WWW   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: default paths
Reply #2 - Nov 20th, 2011, 2:03pm
 
I like the second option, and that's what I've been doing, using a User attribute with this path. But this is an attribute that should persist across all repositories. So it really should be a system attribute with a sensible default.

Yes, this belongs in Feature Requests.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: default paths
Reply #3 - Nov 20th, 2011, 2:08pm
 
I see sense in this suggestion.  My seeming antipathy to using external scripts is I can reliably pass a TBX and a script and have a non-techie use the able to 'just' use them. I think that being able to - for instance - to tell TB to look in the TBX's folder for a script would be very useful.

(I am mindful that using a lot of shell calls can impact TB performance, but in the circumstance were it's the only route that's probably not a concern).
Back to top
 
« Last Edit: Nov 20th, 2011, 2:10pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: default paths
Reply #4 - Nov 20th, 2011, 3:44pm
 
Exactly. When I use complicated TBX actions, I store them in a note, then embed those notes as actions where I want to use them. It would be great to also store Perl or Python scripts in a note, with a flag indicating which interpreter to use, perhaps. Then I could use them in the same way.

Even better, I can use my external programming environment to develop and test external scripts...before moving  them into TBX notes. One major weakness of TBX, I think, is that it's very hard to develop and test complicated actions (hence the advice: "avoid complicated rules and actions").
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: default paths
Reply #5 - Nov 22nd, 2011, 10:45am
 
Why not simply set your system's PATH environmental variable to include your favorite script directory?  Just add the new path(s) to /etc/paths and you're set.
Back to top
 
 
WWW   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: default paths
Reply #6 - Nov 22nd, 2011, 12:13pm
 
Because I may want to bundle the scripts with the TBX document itself, so I can use scripts with the same name but different functions in different contexts, or so I can share a functional TBX document and support tools without having to share unrelated scripts.

The more I think about it, the more I would like the idea of having a NOTE  with code, and an attribute saying which interpreter should be used to execute it. e.g. $CodeInterpreter="python", $MyCode.Text="my python program".
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: default paths
Reply #7 - Nov 22nd, 2011, 2:26pm
 
Wouldn't it be more natural to use the standard shebang declaration in the script note?

#!/usr/bin/perl
#!/usr/bin/python

etc?
Back to top
 
 
WWW   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: default paths
Reply #8 - Nov 22nd, 2011, 2:37pm
 
Yes, it would be better to use "normal" unix conventions for path and shebang!

Combining those two: I could write the script as a note (with shebang), and then execute with runCommand(ScriptInANote)!

That's elegant. I'll give it a try.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print