Pages: 1
RSS
Help with Macro expression with %ATTACH= string, How to insert another Macro in an expression
 
I looked around the forum for about 1 hour but I wasn't able to find a solution.

What I want to do is something like that:

%ATTACH="C:\Documents\... .\%TOFNAME.pdf"

Before and at the end of %TOFNAME I inserted every kind of characters ("" %)
but it didn't work.

Anyone can help
Thanks
Igor
 
That should work, as I had no .pdf available, I tried it with this macro:
%ATTACH="C:\Test\%TOFNAME.txt"
and that worked as intended.
So the question that remains is how (or when) do you execute the macro?
I placed it in a reply template, that means that the addressee is known before the macro is executed.
However, when you execute the macro before the addressee is known, you won't get the proper file name.

When the file can't be found, you get an error message, what message do you get?
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Quote
Roelof Otten wrote:
That should work, as I had no .pdf available, I tried it with this macro:

%ATTACH="C:\Test\%TOFNAME.txt"

and that worked as intended.

Sorry I wasn't clear enough in my post above. Yes the string works correctly
like that ... but what the filename (PDF or other) is composed by another text
like:

FileName_number.pdf
So the string should look like

%ATTACH="C:\Test\%TOFNAME_54.txt"

In this case I get an error like that:

Couldn't find the file G:\..... .\.pdf

Note that the result of %TOFNAME_54 is missing

Igor
 
That's because TB doesn't know that the macro ends at the underscore, so it considers ToFName_54 as the full macro and that macro doesn't exist and therefore it gives an emnpty string.
I'd suggest something like this:
%Attach="C:\test\%ToFName%-_54.txt"
The %- macro is intended to ignore line breaks in your templates, but it can be 'abused' to signal the end of a macro in cases like this.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Quote

I'd suggest something like this:

%Attach="C:\test\%ToFName%-_54.txt"

Thank you very much, not only for the solution but as I learned something new about TB

Igor
Pages: 1