I have couple of questions with regard to executing a VBScript program as part of pre-installation action.

a) I dont want this script to be installed in the system. I just want to use it for the preinstallation test alone. How do I achieve this ?

b) The runProgram and the subsequent error condition doesnt seem to get executed. What am i missing here ?

The code snippet is :

    <customErrorMessage>SQL Express 2005 is not installed. Please install all the pre-requisites and launch this installer.</customErrorMessage>
    <explanation>Checking the pre-requisities</explanation>
    <programArguments>/NOLOGO "${installdir}/IsSQLExpressInstalled.vbs"</programArguments>
            <text>Please install the prerequisites first and then try this installer.</text>

asked 16 May '12, 10:23

Dracu's gravatar image

accept rate: 0%

Regarding only having the file temporarily, you can use <writefile> to create it, then <runprogram> and finally <deletefile>. For example:

         (script contents)
     <programArguments>/NOLOGO "${system_temp_directory.dos}/script.vbs"</programArguments>

As for it not running, are you sure the script exits with non-zero exit code? If it exits with exit code 0, then nothing will be shown.

You can add some debug commands (such as MsgBox("Hello world")) to verify that VBS is run.

You can also specify invalid path to VBS script to check if the <runprogram> and error actions are run.


answered 16 May '12, 11:03

wojciechka's gravatar image

wojciechka ♦♦
accept rate: 26%

Thanks wojciechka, Your suggestion solved one of my questions. However, the runProgram's error condition is not getting invoked. I have tried changing the conditions to "equals", "does_Not_equal" etc., but havent yet tasted success. Have emailed you the code snipped/. Its too big to be posted here

(16 May '12, 14:25) Dracu

Is the <runProgram> failing? The <onErrorActionList> is just executed if the <runProgram> fails so if the program executes properly, the <throwError> will never appear, regardless of the rule. In addition, if you are using the <throwError> just to configure the message that the end user will get, you could simply set a <customErrorMessage> for the runProgram:

     <customErrorMessage>Please install the prerequisites first and then try this installer.</customErrorMessage>
     <programArguments>/NOLOGO "${system_temp_directory.dos}/script.vbs"</programArguments>

answered 16 May '12, 15:11

juanjo's gravatar image

juanjo ♦♦
accept rate: 23%

Juanjo, I want this error message only when the return value of the script is not equal to 1. How do I add this condition ?

(16 May '12, 15:43) Dracu

Juanjo & wojciechka ,

Thanks for your help.

Finally got what i wanted. Added a separate throwError after the runProgram and it did the job.

<throwerror> <text>Prerequisites not installed. Please install them and run this installer.</text> <rulelist> <comparetext> <logic>does_not_equal</logic> <text>${program_exit_code}</text> <value>1</value> </comparetext> </rulelist> </throwerror>

answered 17 May '12, 09:36

Dracu's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 16 May '12, 10:23

Seen: 2,309 times

Last updated: 17 May '12, 09:36