Pages: 1
RSS
Macro in macro possible?, How to use nested macros
 
Hi,

I need to use one macro in another.

To be specific, I need to use a macro in a template, which inserts a custom header.
The custom header has name and value (not sure if these are the correct terms).
If I put something like
%SETHEADER(X-sUID,"HEADER_VALUE")
,this works OK.

But I want HEADER_VALUE to be retrieved from a .txt file.

I tried
%SETHEADER(X-sUID,"%PUT='C:\test.txt'")
%SETHEADER(X-sUID,'%PUT="C:\test.txt"')
%SETHEADER(X-sUID,%PUT=#"C:\test.txt"#)

and several other variations, however the custom header is not inserted.
Can this be done and which is the correct way?

Thanks.
 
I tried several varieties and all of these work, though I like the first best.

%SetHeader(X-sUID,%Put('C:\Temp\pet.txt'))%-
%SetHeader(X-sUID,"%Put('C:\Temp\pet.txt')")%-
%SetHeader(X-sUID,%Put='C:\Temp\pet.txt')%-
%SetHeader(X-sUID,"%Put='C:\Temp\pet.txt'")%-

I tested this with TB 3.85.03 (latest release) what version are you using?
Are you sure you're pointing to an existing file?
The reason that I didn't point to a file in the root directory of C: is that I'm running a restricted user account under Windows and therefore I lack the writing rights needed to create an appropriate file file in the root.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thank you very much Roelof!

This way it works. I was not aware I should put % at the end, not to mention the "-" sign after it - nothing about this in the help. When are these needed?
 
% is not needed at the end, %- is a macro, which removes CRLF
Pages: 1