Pages: 1
RSS
How to set account wide variable?
 
Hi,
I'm trying to figure out if there is a way to set a variable that can be used in multiple templates. Is there a way to actually create a macro in addition to the premade macros? What i'm trying to do is have the destination URL of a link be a changing value.

For example i have

http://link.com (but with the html editor the destination url of this hyperlink would actually be google.com for example).

I was able to achieve this by setting a variable in the template but the problem is I have perhaps 20 templates and I don't want to have to edit the variables in each template every time i need to change the destination URL.

I also tried doing this with a cookie and an external file which had the value in the file...but %COOKIE didn't seem to work inside the destination url field of the link.

Can anyone enlighten me on if there's a way to create a macro and be able to change the value of it account wide? Thanx!
 
put the url in a .txt file, like C:\myURL.txt
Then use %PUT or %INCLUDE macro
%Put('C:\myURL.txt')
 
Hi,
Yes that puts the value account wide but it doesn't work as a destination URL in a hyperlink. The only thing that seems to work in a hyperlink is  %VARname. Which means i have to declare the variable in each email template which is a lot of work. I tried putting a %PUT macro inside of a %VARname macro but it doesn't work. Is there anyway to put a macro inside of another macro?

Essentially i need something like this:

%VARname="%PUT="C:\file.txt""

then in my hyperlink's destination URL i use %VARname
 
try putting the whole link in C:\file.txt, not just the URL, like
Code
<a href="...">Visit something</a>


If this inserts html code as plain text, try with html entities - e.g. & lt instead of <

--
theBat keeps templates in Account.CFN file , if I correctly remember. Open this file in a text editor, find a template that contains a link and see how that link looks - this may give you a hint what to put in C:\file.txt
Or directly find/replace the URL everywhere in Account.CFN file (after making a backup copy)
Edited: bigg one - 05 November 2010 08:49:34
 
Hey Bigg...i took your advice and tried the whole link. It just gets inserted as plain text regardless if i use html entities or not :/

Do you know where i can find this account.cfn file? I've looked all over for it but can't seem to find it.  Thanx so much!
 
account.cfn is in <mail folder>\<account folder>
You can see where <mail folder> is in Options > Preferences > System > see Mail Directory

Note that if <mail folder> is somewhere under
C:\Documents and Settings\<username>\Application Data
, then it's probably with Hidden attribute. When you search for account.cfn, make sure to set Windows look inside hidden/system folders as well (it does not by default).

BTW I use version 3.85, not 4.x. In 4.x templates may be elsewhere.
If you can't find account.cfn, insert in some template a long unique string. Then search for files containing that string under <mail folder>

Not sure if quick templates are stored in the same file where templates are.

Indeed all the above would be useless if you use encrypted message bases, I think in that case configuration files are encrypted too.
 
or another way could be, in your template put this

Code
http://%PUT('C:\myURL.txt')


In C:\myURL.txt put the rest of the URL (what's after http:// )without any html tags, qoutes or whatever - like google.com
Then theBat will convert that to a hyperlink, or at least it does so in v.3.85 plain text messages.

Disadvantage is you can't set the link text, it's link URL.
Edited: bigg one - 05 November 2010 22:48:25
 
Hey Bigg, thanx again for all your help. It turns out the file that had the code to give a "hint" was ACCOUNT.srb

Here is the structure that i found for how the Bat parses links

<a\20href\3D\22http://www.destinationURL.com\22>http://www.visitsite.com</a>;


I threw that into my txt file that is being pulled by the %PUT macro and it still parses it as plain text! lol

At this point i'm sorta losing hope that this can be done, but i'm still digging. Thanx again for your help, if you have any other ideas let me know. Thanx! :)
 
one way could be, close theBat, open ACCOUNT.srb in some text editor, and replace all occurrences of
<a\20href\3D\22http://www.destinationURL.com\22>
with <a\20href\3D\22http://www.newURL.com\22>
This way all the templates can be updated at once in a second. Indeed make a backup copy before replacing.

another way could be, make a quick template with the URL.
You can insert a quick template in a template with %QT macro.
If this works, to update the URL everywhere you'll only have to modify the quick template.
 
the %QT macro worked!!! Genius! Thanx so much for all of your help, you've been amazing!  :D  :D  :D
Pages: 1