VBEval - Escaping Parameters Passed

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
MikeB941
Newbie
Posts: 17
Joined: Sat Jul 07, 2007 7:53 pm

VBEval - Escaping Parameters Passed

Post by MikeB941 » Sun Jan 22, 2012 9:06 pm

Macro Scheduler Pro 12.1.10

I'm attempting to send email via SSL using a VBScript function called by VB Eval (i.e. http://www.mjtnet.com/forum/viewtopic.php?t=5128) however my email body string variable contains characters that are causing the dreaded error 1033 unterminated string constant.

VBEval>SendGmail("%VBSEmailSubject%","%VBSEmailFrom%","%VBSEmailTo%","%VBSEmailBody%"),CS_SendMailResult

Is there a way (a function, "escaping", etc.) to make the email body string variable "safe" to pass as an argument to VBEval.

I've tried double quoting:
VBEval>SendGmail("%VBSEmailSubject%","%VBSEmailFrom%","%VBSEmailTo%","""%VBSEmailBody%"""),CS_SendMailResult

but that didn't work.

Thanks very much for your help. Take Care... Mike.

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

Post by Marcus Tettmar » Mon Jan 23, 2012 11:16 am

You probably have the quote char inside one of your variables.

Double quote them by replacing all occurences with another:

Code: Select all

StringReplace>VBSEmailSubject,","",VBSEmailSubject
StringReplace>VBSEmailBody,","",VBSEmailBody
StringReplace>VBSEmailFrom,","",VBSEmailFrom
StringReplace>VBSEmailTo,","",VBSEmailTo

VBEval>SendGmail("%VBSEmailSubject%","%VBSEmailFrom%","%VBSEmailTo%","%VBSEmailBody%"),CS_SendMailResult 
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