hi gang,
I need to add an entry to an ini file via a vbscript. does anyone have a vbscript sample i can work from?
thanks in advance
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Hi Mike,
are you installing an MSI? If yes, there is built in support for this. Much easier and more robust then VBS.
Regards, Nick
Answered 04/11/2007 by: nheim
Tenth Degree Black Belt

Please log in to comment
i am afraid that i am toying with a vendor msi that writes an ini file after the inifile action so my entires in the inifile table are useless. i need to do it at the end of the IE sequence as i cant pin point which custom action is creating the ini file!
sorry, i should have made that clear from the start
Answered 04/11/2007 by: spiderman3
Senior Yellow Belt

Please log in to comment
We use this VBscript as a custom action in our install of Adobe Elements 5.0. The background is that we don't want to make a separate transform to slipstream the serial number for each user. Instead, we have created a file called 'serialList.txt' that this script references. Inside of the text file, there is a Machine:Serial listing for each macine.

The script generates an ini file called abcpy.ini that the install can use. You'll need to retrofit the script to your needs, but based off of your description, you could use this as a jumpingpoint quite easily. We added the GetSerialNumber.vbs to the BinaryTable and then created a custom action with the following properties:
Action: [OurUniqueCAName -- GenerateABCPY_INI]
Type: 6
Source: [Reference to the Binary Table -- GetSerialNumber.vbs]
Target: MyVBScriptCA -- This is the function name within the vbs file

Here is the script itself:
Function MyVBScriptCA()

Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2

iniFile = "abcpy.ini"
serialFile = "serialList.txt"
dir = "\\server\share\elements_5_0\"

Set shell = CreateObject("WScript.Shell")
Set env = shell.Environment("process")
ComputerName = env("COMPUTERNAME")

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objSerialFile = objFSO.OpenTextFile(dir & serialFile, ForReading, True)

Do While Not objSerialFile.AtEndOfStream
strLine = UCase(Trim(objSerialFile.ReadLine))
if instr(1, strLine, ComputerName) then
SeparatorPosition = InStr(strLine, ":")
Serial = Right(strLine, Len(strLine) - SeparatorPosition)
end if

Set objTextFile = objFSO.OpenTextFile (dir & iniFile, ForWriting, True)

objTextFile.WriteLine(";Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=333353")
objTextFile.WriteLine(";USERNAME and SERIALNUMBER are the only required parameters")
objTextFile.WriteLine(";Also reference http://itninja.com/link/a-seperate-entry-in-the-package-database-for-adobe-help-center")
objTextFile.WriteLine("[OEM Install]")
objTextFile.WriteLine("USERNAME=" & ComputerName)
objTextFile.WriteLine("SERIALNUMBER=" & Serial)


' return success
MyVBScriptCA = 1
Exit Function
End Function

Answered 04/11/2007 by: dlernstrom
Senior Yellow Belt

Please log in to comment