/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (3)

Posted by: nheim 17 years ago
10th Degree Black Belt
0
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
Posted by: spiderman3 17 years ago
Senior Yellow Belt
0
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
Posted by: dlernstrom 17 years ago
Senior Yellow Belt
0
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
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.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ