August 22, 201312 yr We have a function that takes multiple script parameters in order to send an email. (we do this because we need to check for a maintenance variable which governs who gets the email) I am sending parameters as newlines and using (Get(ScriptParameter);1) to retrieve them. Works great unless a parameter as a newline, like the body of an email does quite often. I can use Quote(text) to get it into the function properly but once its there I cant unescape the newlines to get them into the email properly. Does anyone have a tip on how to either pass parameters that accept newlines or to undo Quote once it arrives (just for newlines if thats easier). I tried Substitute(text) without any luck. Tx! John-
August 22, 201312 yr Get(ScriptParameter) does not allow breaking down the parameter; it collects the entire parameter that was passed. You must parse it after you retrieve it: Set Variable[$ScrptParam; Get(ScriptParameter)] // the quote function is not necessary! Set Variable[$FirstParam; GetValue($ScrptParam; 1)] // first line in parameter //etc I'm not clear about what the newlines in the parameter are doing in the script, so if the above doesn't work, give us a more detailed description of what you are trying to accomplish.
August 22, 201312 yr You can use Evaluate ( GetValue ( Get ( ScriptParameter ) ; 1 ) ) to unquote the Quote()d parameter. Can I convince you to use a name-value script parameter structure? Most of the techniques out there for it will handle this kind of thing for you.
August 22, 201312 yr Is there a reason why you can't start your script by loading each value into its own individual variable? That would not only eliminate the need for parsing, but also retain the values' data types (not to mention the added clarity by having a meaningful name for each value). I tried Substitute(text) without any luck. Well, if the script parameter is = Substitute ( text ; ¶ ; "§" ) then = Substitute ( Get (ScriptParameter) ; "§" ; ¶ ) will retrieve the original text.
August 22, 201312 yr I agree with Mr. Bante, name/value pairs are where it's at. I use a somewhat simpler routine that consists of only one custom function to parse out the parameter -- I don't use a function to send the parameter. Mr. Comment, good to see you again!
Create an account or sign in to comment