displaying file content - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

displaying file content

Hi,

I am trying to execute a sql script and storing the script in a file at install time eg: sss.log file. Now I want to display the file content i.e. sss.log file content in a message box. Following is the vb script for reading the file content :
Option Explicit

Const conForReading = 1

'Declare variables
Dim objFSO, objReadFile, contents

'Set Objects
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFSO.OpenTextFile("D:\dbscript\sss.log", 1, False)

'Read file contents
contents = objReadFile.ReadAll

'Close file
objReadFile.close

'Display results
wscript.echo contents

'Cleanup objects
Set objFSO = Nothing
Set objReadFile = Nothing

'Quit script
WScript.Quit()

I have placed the script in a readfile.vbs file. I need to execute this script once the sss.log is getting created. Please let me know how to do it.

Its urgent issue. Need your immediate help..

Regards
Sony
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: displaying file content

Hello Sony,

Why are you not displaying the message box from your script?
If you do not want this, you can store the contents of the file you read inside a properly. Properties can be accessed using Session.Property("YOUR_PROPERTY_NAME"). This returns a reference to
your property, so you can use it both to get the value or assign a value to your property:

Code: Select all

val = Session.Property("YOUR_PROPERTY_NAME")
Session.Property("YOUR_PROPERTY_NAME") = newval
You can then use that property inside your installer. Create a Message Box custom action from the custom actions page and display the value of that property inside it.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: displaying file content

Hello Gabriel,

Thank you for your suggestion.

I have used the message box from the vbscript. I would like to exit the installation from the vbscript after displaying the message box. How can I do it?

Regards
Sony
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: displaying file content

Hi Sony,

For this, your vbscript should be a vbscript attached custom action.
In the Function name field, input the function found in your vbscript.
Depending on the value your function returns, the installer will either suspend, terminate or continue.
The following article explains the return values:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Make sure the function in your script is returning one the values found in the "Values that appear in the Log." column.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”