mfisch
Hello all,
I am using a batch with TC.EXE, which runs an .inp file for all raw files in a specific folder. The .bat file looks like this:
c:
cd c:\XRD\Topas4
for %%A in (c:\Batch\*.RAW) do (c:\XRD\Topas4\tc c:\Batch\Ext_Std.inp "macro File { %%~nA }")
Within the .inp file, scan files are loaded with the RAW(File) command, for each raw file in the folder, "File" is replaced with the respecting file name.
Now, I would like to use an #include command in the same input file, which loads a .txt file, which has the same name as the raw file. So, for each raw file, a corresponding text file is available. The text file contains only one single number.
I tried
prm xyz = #include File.txt ;:0 but this does not work. I thought, "File" from File.txt would be replaced by the correct name, but it is not. If I manually insert the filename of the text file, everything works ok, but then, batch processing is not possible.
Any ideas? Thanks!
mfisch
... and providing a possible solution myself:
macro TXT(path) {#include path##.txt}
prm !xyz = TXT(File) ;:0
Any better ideas?
mfisch
One more thing:
Is it possible to define lines from an external text file? As in the example above:
macro TXT(path) {#include path##.txt}
prm !xyz1 = TXT(File, Line1) ;:0
prm !xyz2 = TXT(File, Line2) ;:0
prm !xyz3 = TXT(File, Line3) ;:0
prm !xyz4 = TXT(File, Line4) ;:0
alancoelho
Hi Mfisch
I just tried the following using Version 4.1:
tc test_examples\aac1.inp "macro File { #include aac2.inp }"
where aac1.inp contained:
xdd File
and aac2.inp contained:
ceo2.xdd
and it works. The tc.log file contained:
xdd ceo2.xdd
cheers
alan
mfisch
Hi Alan
Thanks for your reply but this is not what I would like to do. I'm looking for a solution to import single lines from an external text file to different parameters:
The text file should contain XRF data of a sample, always in the same order, only values, e.g:
'Start of text file XRF_Sample.TXT
60.00 'wt.-% SiO2
30.00 'wt.-% Al2O3
10.00 'wt.-% Fe2O3
'End of text file XRF_Sample.TXT
Within the Topas .inp file, I would like to import the individual results (each line) to a separate parameter:
macro TXT(path) {#include path##.txt}
prm !SiO2 = TXT(File, Line1) ;:0
prm !Al2O3 = TXT(File, Line2) ;:0
prm !Fe2O3 = TXT(File, Line3) ;:0
Which should be read as
macro TXT(path) {#include path##.txt}
prm !SiO2 = TXT(File, Line1) ;:60.0
prm !Al2O3 = TXT(File, Line2) ;:30.0
prm !Fe2O3 = TXT(File, Line3) ;:10.0
Thanks,
Martin
alancoelho
Hi Martin
What about:
Included file INCLUDE.TXT:
macro Line1 { ### }
macro Line2 { ### }
macro Line3 { ### }
...
INP file:
#include INCLUDE.TXT
prm !SiO2 = Line1 ;:60.0
prm !Al2O3 = Line2;:30.0
prm !Fe2O3 = Line3;:10.0
cheers
alan
mfisch
Hi Alan
Of course, this works. It was still about having an external file without any Topas commands... But I doubt that there is an easy solution.
Regards,
Martin
alancoelho
Hi Martin
If I understand correctly you would like to read a file and pick out lines from
that file. This can be done by simply reading the file, ie.
line 1
line 2
etc...
and streaming into an output file:
macor line1 { line 1 }
macor line2 { line 2 }
macor line3 { etc... }
Such an operation is trivial to implement with the samllest of programs using
any number of scripts/languages. In fact I'm pretty sure it can be done in jEdit BSH.
Its ceratinly not something I would implement in the Kernel of TOPAS.
I can only suggest asking your IT department to implement such a task.
If you cannot get anyone to write such a small program then I can get involved but there would be a fee to cover my time.
cheers
alan
mfisch
Hi Alan
I was looking for a solution to do this within Topas (in batch mode). If this is not possible, there are other solutions for workarounds. Thank you!
Martin