Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Processing Text files


4 replies to this topic

BobRouse

BobRouse
  • Members
  • 82 posts

Posted 01 May 2001 - 22:06

Can a CA VBScript open an external text file that is part of the installation (not already on the target hard drive)?

Here's why: I'd like to create a simple "generic" VB script function to run a SQL command on a "3rd Party" SQL-Server. In my installation program, I'd like to call the CA several times, using different SQL-Scripts, servers, DBs, etc. I'd like to use the path to a SQL Command file as a parameter, then have the VBScript open the file, read it into a string var, and execute it against a SQL-Server.

The SQL scripts are rather large (creating tables, stored procedures, etc.), hence my aversion to coding them directly in the VBScript. If I could open the files in the InstallScript and pass in the entire script text using Session.Property() in the VBScript, that would work too.

The thing I don't know how to do is open an external file and read the text when the file is included as part of the install.



Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 01 May 2001 - 23:28

You need to use a deferred custom action, or place an immediate custom action very late in the execute sequence.  I have a VBScript custom action that also reads in a SQL script to create a database, I have it sequenced just after InstallFinalize.

Stick with passing in the filename to the VBScript, then reading it in there.  While a VB String variable can hold a huge amount of information, I'm unsure if there are restrictions to the length of a property.

Any problems, let me know.


BobRouse

BobRouse
  • Members
  • 82 posts

Posted 02 May 2001 - 15:09

Thanks - a couple questions though:
1) Do you only pass in the file name (not the path), since the file will be included as part of the installation package?
2) Where do you add the SQL script file into the installation package so that the VBScript can access it?
Thanks again....

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 02 May 2001 - 23:39

The SQL Script is added to the package the same as any other file.  I place them in a seperate directory ([INSTALLDIR]\Database), then they are copied to the target system the same as all the other files.

I only pass in the file name, because the Install directory is already available.  I build the path in the VBScript.