Skip to content Skip to sidebar Skip to footer

Passing Parameters To A Batch File From Javascript Inside Hyperion Interactive Reporting Studio

Inside of Hyperion Reporting Studio I have a document level script where I wish to call a batch file and pass arguments to the batch file. Here is the code I have: var Path = 'W:\

Solution 1:

Because var Attach = "W:\Maughan.xls" should be var Attach = "W:\\Maughan.xls".

Within a string the escape character \ just escapes the next character so Attach will contain just W:Maughan.xls. To add \ you need to use \ twice.

Update:

It may have no difference in this particular case, because W:Maughan.xls means to look for Maughan.xls in the current directory on the drive W which is most likely \.

But what is definitely important are quotes around the parameters Subject and Body. In you code the constructed command is

W:\directory\Reference_Files\scripts\vbs\SendEmail.bat my.email@xxx.com My Subject My Body W:Maughan.xls

I sure that the bat file cannot distinguish between the subject and body (unless it expect exactly two words in each of them) so the right command most likely is

W:\directory\Reference_Files\scripts\vbs\SendEmail.bat my.email@xxx.com "My Subject""My Body" W:\Maughan.xls

and you can check it by running the command above in cmd.

To construct it the parameters should be modified as follows:

varPath="W:\\directory\\Reference_Files\\scripts\\vbs\\SendEmail.bat"varEmail="my.email@xxx.com"varSubject="\"My Subject\""varBody="\"My Body\""varAttach="W:\\Maughan.xls"

(this correction was inspired by impinball's answer)

Solution 2:

Try putting an escaped quote on either side of the variable values. Depending on where the directory is, that may make a difference. The outside quotes in strings aren't included in the string values in JavaScript. Here's an example of what I'm talking about:

varPath="\"W:\\directory\\Reference_Files\\scripts\\vbs\\SendEmail.bat\""

instead of

varPath="W:\\directory\\Reference_Files\\scripts\\vbs\\SendEmail.bat"

Post a Comment for "Passing Parameters To A Batch File From Javascript Inside Hyperion Interactive Reporting Studio"