You are not logged in.
Pages: 1
Howdy:
First, thanks for this great program--it really works very well. It's easy to use too. Except now I've run into something difficult (for me):
I've got about 500 SGML files (plain text with <tags> in them) that currently have unhelpful numbers for names--for example, 1414429908-00001.sgm. I would like to rename each file with the contents of its <title> tag--that is, all the files contain (near the top) a line like this:
<title>The title of the file</title>
So renaming 1414429908-00001.sgm using its <title> tag info would make it Abnormal involuntary movement scale.sgm (ideally, the same operation would also lowercase all the letters and change spaces to underscores; but that could be a separate step).
From what I've seen in the forum, it looks like I'll need a Pascal script for this--but my expertise stops at basic regular expressions. I'd really appreciate any help you can offer.
Many thanks,
Brig
Last edited by Brig (2009-04-17 19:39)
Offline
Howdy Brig,
You are right, normally you would need PascalScript for this kind of operations. But in your case you can use little trick called HTML_Title meta tag. This tag will extract content of <title>*</title> tag within HTML file, so the only thing you need to do is to make ReNamer think your SGM files are HTML files.
Your renaming operation needs to be done in 2 steps:
1) Temporarily change *.SGM extension to *.HTML, rename;
2) Add :HTML_Title: tag from within Insert rule, and change back to original *.SGM extension, rename.
Offline
Wow! Fabulous! That is just great.
Thanks for your help and, again, for this amazing program.
Best,
Brig
Offline
Howdy Brig,
You are right, normally you would need PascalScript for this kind of operations. But in your case you can use little trick called HTML_Title meta tag. This tag will extract content of <title>*</title> tag within HTML file, so the only thing you need to do is to make ReNamer think your SGM files are HTML files.
Your renaming operation needs to be done in 2 steps:
1) Temporarily change *.SGM extension to *.HTML, rename;
2) Add :HTML_Title: tag from within Insert rule, and change back to original *.SGM extension, rename.
I tried that with wma files. When I changed the extensions to HTML, the files lost all the meta data, or at least it no longer shows under properties. When I tried the "insert" operation, nothing was renamed with the "Title" value.
Offline
I tried that with wma files. When I changed the extensions to HTML, the files lost all the meta data, or at least it no longer shows under properties. When I tried the "insert" operation, nothing was renamed with the "Title" value.
WMA files are not like HTML, they store binary content while HTML has plain text tags which can be easily extracted. You can see the difference easily when you open those files with a text editor. So that trick will not work with WMA files.
For WMA files you should use :WMA_Title: meta tag from the Insert rule. For more info check out Meta Tags article on the Wiki.
Offline
Pages: 1