This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Can I read an ascii file in vbscript custom action ?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 22, 2011
08:16 AM
Can I read an ascii file in vbscript custom action ?
I have a txt file from which I have to read some lines but I get an error.
The vbscript works well if it is started from Win7 but I get an error starting int from IS2011Express.
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFileRead = fso.OpenTextFile("c:\mydir\testfile.txt", 1)
MyLine = MyFileRead.ReadLine
MyFileRead.Close
Anyone have an idea ?
The vbscript works well if it is started from Win7 but I get an error starting int from IS2011Express.
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFileRead = fso.OpenTextFile("c:\mydir\testfile.txt", 1)
MyLine = MyFileRead.ReadLine
MyFileRead.Close
Anyone have an idea ?
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 22, 2011
01:03 PM
Your VBScript works on my side. I can run it successfully from a setup created in InstallShield 2011 Express. Can you provide more details about the error? I am also curious what type of custom action you are using and where you sequence your action.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 23, 2011
04:37 AM
Sorry,
I have done an error in my vbs. Extracting the lines for this thread I have correct the error.
Now can write and read the file.
I write the file with some "Properties" in "After Ready to install" and I use them
in "After file transfer", where the properties are not available.
Do you think there is a better way to get properties "After file transfer" ?
'script to write the properties in a file
Set fso = CreateObject("Scripting.FileSystemObject")
Set TmpFolder = fso.CreateFolder("c:\MyDir")
Set MyFile = TmpFolder.CreateTextFile("testfile.txt", True)
MyFile.WriteLine( Session.Property("INSTALLDIR") )
MyFile.WriteLine( Session.Property("DATABASEDIR") )
MyFile.WriteLine( Session.Property("SourceDir") )
MyFile.Close
'script to read the properties in a file
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile("c:\\MyDir\\testfile.txt", 1)
TheLine = MyFile.ReadLine
TheLine = MyFile.ReadLine
TheLine = MyFile.ReadLine
MyFile.Close
I have done an error in my vbs. Extracting the lines for this thread I have correct the error.
Now can write and read the file.
I write the file with some "Properties" in "After Ready to install" and I use them
in "After file transfer", where the properties are not available.
Do you think there is a better way to get properties "After file transfer" ?
'script to write the properties in a file
Set fso = CreateObject("Scripting.FileSystemObject")
Set TmpFolder = fso.CreateFolder("c:\MyDir")
Set MyFile = TmpFolder.CreateTextFile("testfile.txt", True)
MyFile.WriteLine( Session.Property("INSTALLDIR") )
MyFile.WriteLine( Session.Property("DATABASEDIR") )
MyFile.WriteLine( Session.Property("SourceDir") )
MyFile.Close
'script to read the properties in a file
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile("c:\\MyDir\\testfile.txt", 1)
TheLine = MyFile.ReadLine
TheLine = MyFile.ReadLine
TheLine = MyFile.ReadLine
MyFile.Close
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 23, 2011
12:34 PM
The C:\ drive may not be available on all of your target machines. I would use the Windows temporary directory instead of creating the C:\MyDir folder as follows:
Also, the custom action at the "After Ready to install" location will not be executed for silent installations. If it is a problem, you may want to consider upgrading to InstallShield Pro or Premier edition. The Express edition does not have the ability to create immediate custom actions in the Exec Sequence.
Const WindowsFolder = 0
Const SystemFolder = 1
Const TemporaryFolder = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set TmpFolder = fso.GetSpecialFolder(TemporaryFolder)
Set MyFile = TmpFolder.CreateTextFile("testfile.txt", True)
Also, the custom action at the "After Ready to install" location will not be executed for silent installations. If it is a problem, you may want to consider upgrading to InstallShield Pro or Premier edition. The Express edition does not have the ability to create immediate custom actions in the Exec Sequence.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 24, 2011
04:28 AM
I have changed my vbs file and now I use the windows temporary directory.
Thank you for your support.
I have another question about IS2011express and Crystal report for VS2010.
The msm for CR doesn't install in Win7.
Reading the forums I have found some suggestion and now I run 2 custom action at "After install Welcome" to install "VC2005redist.exe" and "VC2005Redist.exe for ATL".
Without these files installed before proceed with the installation the CR mcm setup do an error when registering the dll.
Including the provided "Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)" instead of the 2 microsoft .exe bootstapper doesn't solve the problem.
Have you any suggestion ?
Thank you for your support.
I have another question about IS2011express and Crystal report for VS2010.
The msm for CR doesn't install in Win7.
Reading the forums I have found some suggestion and now I run 2 custom action at "After install Welcome" to install "VC2005redist.exe" and "VC2005Redist.exe for ATL".
Without these files installed before proceed with the installation the CR mcm setup do an error when registering the dll.
Including the provided "Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)" instead of the 2 microsoft .exe bootstapper doesn't solve the problem.
Have you any suggestion ?