About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« I think I need to change my name... | Main| RSS should be fixed, and let's get edumacated! »

Ok... what am I doing wrong here?

Category Software Development

I am trying to code a formula for a smarticon.  This formula will add a signature to an email starting wherever the cursor is currently placed.  So far, no problem.  The twist is that I may want to click the button again in order to pick up a different tag line in the array.  I'd like the formula to be smart enough to wipe out the old signature and replace it with a new one...

Here's the formula I have so far (and the code COULD use some cleanup, but I've been trying a lot of different things to no avail):

REM {Insert as many signature tag lines as you'd like};
TagLine := ("Funny Tag Line #1":
"Funny Tag Line #2":
"Funny Tag Line #3");

REM {Store the number of tags you are using, along with the number of @NewLine commands in your signature};
NumberOfTagLines := 3;
NumberOfNewLines := 9;

REM {Get the environment variable of the next tagline to use, or set it to one if it's never been set before};
NumberNextTag := @Environment(sigLastTagUsed);
NumberNextTag := @If(NumberNextTag = "";1;@TextToNumber(NumberNextTag));

REM {Increment the value by 1, or reset it to 1 if you've reached the end of your tags.  Store it, too.};
NumberNextTagPlus1 := @If((NumberNextTag + 1) > NumberOfTagLines;1;NumberNextTag + 1);
@SetEnvironment(sigLastTagUsed;@Text(NumberNextTagPlus1));

REM {Remove the old signature before writing the new one.  This will be blank the first time through...};
@ReplaceSubstring(@ThisName;Signature;"");

REM {Pick the next tag to use, build the signature field, and place it in the Body field};
ChosenTag := TagLine[NumberNextTag];
FIELD Signature := "";
FIELD Signature := Signature + @NewLine + @NewLine;
FIELD Signature := Signature + "___________________________" + @NewLine;
FIELD Signature := Signature + @Name([CN]; @UserName) + @NewLine;
FIELD Signature := Signature + "Your company name goes here" + @NewLine;
FIELD Signature := Signature + "Your email address goes here" + @NewLine;
FIELD Signature := Signature + "Your phone number goes here" + @NewLine;
FIELD Signature := Signature + @Name([Address821]; @UserName) + @NewLine;
FIELD Signature := Signature + ChosenTag + @NewLine;
FIELD Signature := Signature + "";
@Command([EditInsertText];Signature);

REM {Now reposition the cursor back at the top of the signature so that it can be run over again if necessary};
@For(loopCtr:= 1; loopCtr <= NumberOfNewLines; loopCtr := loopCtr + 1;
@Command([EditUp]))

The problem I have is that the Signature field doesn't seem to be accessible.  It inserts with no problem, but I can't display it in a prompt statement.  When I check the document fields after clicking the icon, the Signature field is out there in the document.  I seem to be so close, but I'm tripping over something...

Any hints?

Comments

Gravatar Image1 - Just a hunch. Not sure if this is right. Maybe save the document before trying to query a value from a field??

Gravatar Image2 - check the order of execution for @Macro language.... (hint @Command and @For and sets ( ":=" ) )

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...

Monthly Archives