Weird concat behaviour

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
novaescrita
Newbie
Posts: 1
Joined: Thu Jul 26, 2018 5:50 pm

Weird concat behaviour

Post by novaescrita » Thu Jul 26, 2018 6:19 pm

Hi,
I'm working with a script that sends multiple emails with multiple attachments and I encountered a weird behaviour on ConCat.

Code: Select all

Let>RecsNumEmails=0
Let>RecsNumEmails=RecsNumEmails+1
Let>RecToEmail_%RecsNumEmails%[email protected]
Let>RecMailAttachments_%RecsNumEmails%={""}

// Hardcoded email number 1
ConCat>RecMailAttachments_1,somefile.pdf; 
// Using the email number counter to ConCat attachments
Concat>RecMailAttachments_%RecsNumEmails%,someotherfile.pdf;
This produces the following variables and results:

Code: Select all

0: RECMAILATTACHMENTS_1=somefile.pdf;
0: ECMAILATTACHMENTS_%RECSNUMEMAILS=somefile.pdf;someotherfile.pdf;
MS does concatenate the text correctly on the 2nd ConCat, but I can't understand why it doesn't assign the value to the same variable name.
MS "eats" the first letter and the last % of that variable name and stores the ConCat result.

Am I doing something wrong or is this definitely a problem?
Thank you for your time.

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Weird concat behaviour

Post by Marcus Tettmar » Fri Jul 27, 2018 1:11 pm

I wouldn't use ConCat at all. I'd do this:

// Hardcoded email number 1
Let>file1=%RecMailAttachments_1%somefile.pdf
//other file
Let>this_item=RecMailAttachments_%RecsNumEmails%
Let>file2=%this_item%someotherfile.pdf
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts