add ini entry via vbscript
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
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
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
nheim
17 years ago
Posted by:
spiderman3
17 years ago
hi,
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
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
Posted by:
dlernstrom
17 years ago
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:
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
Loop
objSerialFile.Close
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)
'objTextFile.WriteLine("COMPANYNAME=")
'objTextFile.WriteLine("INSTALLDIR=")
objTextFile.Close
' return success
MyVBScriptCA = 1
Exit Function
End Function
'MyVBScriptCA
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.