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
Exporting and naming individual text files (Read 8315 times)
AsafKeller
Full Member
*
Offline



Posts: 77

Exporting and naming individual text files
Sep 10th, 2009, 8:22am
 
I would like to export notes as individual text files, and have these files automatically named as <date created>-<Name>. Is this possible?
Back to top
 
 
  IP Logged
Johnnie Wilcox - mistersquid
Full Member
*
Offline



Posts: 84
San Francisco, CA
Re: Exporting and naming individual text files
Reply #1 - Sep 10th, 2009, 11:43am
 
I think the only way to get this done is to add $Created to the $Name. You can do this with a Rule or Action that looks like

Code:
$Name = $Created +"delimiter"+$Name 



where you replace the word delimiter (keeping the double quotes) with whatever you'd like to use to separate these two data. You can get fancier by formatting $Created with rule like

Code:
$Name=format($Created,"L")+" "+$Name 



which in this example separates the two with a space.

===============

Thanks, everybody, for the clarifcations downthread.
Back to top
 
« Last Edit: Sep 10th, 2009, 2:01pm by Johnnie Wilcox - mistersquid »  
  IP Logged
AsafKeller
Full Member
*
Offline



Posts: 77

Re: Exporting and naming individual text files
Reply #2 - Sep 10th, 2009, 12:04pm
 
Thanks, Johnnie. If I understand correctly, that will change the name of the Note, but not the name of the exported file, which defaults to "exported file".
Back to top
 
« Last Edit: Sep 10th, 2009, 12:04pm by AsafKeller »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting and naming individual text files
Reply #3 - Sep 10th, 2009, 12:36pm
 
The exported filename is set via HTMLExportFilename. The export name is is auto-derived for the name (losing spaces and other non-URL safe characters) or as set otherwise either manually or via action code.  You could use Actions/Rule or perhaps a stamp to set this attribute to the value you want.

I see Mark B's already answered your parallel question about spaces in URLs and why they are generally deprecated.
Back to top
 
 

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



Posts: 77

Re: Exporting and naming individual text files
Reply #4 - Sep 10th, 2009, 12:45pm
 
Thanks, Mark. But this applies to html export, and not text export, correct? I was looking for a solution for exporting as text.
And any feedback on my question regarding export of individual text files (instead of the default behavior, where exported notes are coalesced into a single file)?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Exporting and naming individual text files
Reply #5 - Sep 10th, 2009, 12:52pm
 
In fact, though it's called "HTML Export", there's no requirement that you export HTML.  For example, the template

      ^title
      ^text(plain)

will export the note's title, followed by a return, followed by its text.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting and naming individual text files
Reply #6 - Sep 10th, 2009, 1:03pm
 
The term HTML Export is effectively a method for exporting marked-up text with HTML being the default mark-up. But you can as easily export text file.  If you're exporting via Nakakoji view, then I don't think there is a filename attribute - you supply it when you export. Nakakoji always exports a single file - with the contents depending on the scope of notes you select in the export pane.

If you want to export plain text files, i.e. '.txt', files that you'll need to set the HTMLExportExtension to 'txt'. also use templates that don't insert HTML. Don't take the 'HTML' part of HTML export too literally.

If none of this makes sense it might help if you explained, simply, for what purpose you want output.  By al means offer up a demo TBX of source and an a file simulating the output you want.  It's likely to be possible.

If sharing source data is too sensitive to post in the forum, by all means contact me (email button in my forum profile) so you can discuss the problem in a less public context. I'd only ask that if we get a solution, the generalities of the solution can be shared with fellow users (using made-up specimen data).
Back to top
 
« Last Edit: Sep 10th, 2009, 1:04pm by Mark Anderson »  

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



Posts: 77

Re: Exporting and naming individual text files
Reply #7 - Sep 10th, 2009, 2:59pm
 
Got it; thanks Mark & Mark. Now all I need is for the spaces in exported file names to be retained, and I am all set! (http://bit.ly/2B3y08)
Back to top
 
 
  IP Logged
Paul Walters
Ex Member




Re: Exporting and naming individual text files
Reply #8 - Sep 10th, 2009, 4:30pm
 
Try Automator.  If you export your files with a token where you want the space (e.g., ##) then you can make a workflow in Automator (with the Rename Finder Items action) that replaces the token ## with a space or whatever.  Save the workflow as a folder action attached to your output folder, and whatever is put there will automatically have the text replacement applied to it.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Exporting and naming individual text files
Reply #9 - Sep 10th, 2009, 5:33pm
 
Alternatively, you could use a command line script to process the file(s) in the output folder(s).  I've not tried this but HTMLExportCommand might do this. I'm not 100% sure if the command applies to the file contents or the file/contents. If the latter you could use a CL to substitute spaces for underscores exported folder (i.e. container) and file names. So whether trigger via TB or done in Terminal afterwards (or a CL called via Automator) there ought to be a fix.

I'm not sure how often this process is needed by users in general but perhaps it might be coped with by an HTML group attribute (false by default) that allows the user to suppress URL-encoding of folder/filenames.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print