Login | |
|
 |
RE: Edit INI file using VBS - 10/20/2008 7:00:48 AM
|
|
 |
|
| |
ebgreen
Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
|
This is certainly possible. You would ask the user for input. Then you have some options. One way is to just delete the existing file and write a string out to a new file (with the same name) that has the correct user supplied string. Here are some search terms to get you started: FileSystemObject .ReadAll .ReadLine InputBox .WriteLine .Write Here is some pseudo-code: strNumber = Inputbox("Enter the number") strOut = "[CTI]" & vbCrLf & "teleset=" & strNumber Set oFSO = CreateObject("Scripting.FileSystemObject") oFSO.DeleteFile("C:\Path\To\File\File.Name") oFSO.CreateTextFile("C:\Path\To\File\File.Name").Write(strOut)
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Edit INI file using VBS - 10/20/2008 7:23:03 AM
|
|
 |
|
| |
ebgreen
Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
|
Yes it would work. You now know how to get user input and how to write a string to a file, so you should be able to come up with this on your own. I will point out however that I did the last task the way that I did because the contents of the file were small. This task is a little different in that if I were doing I would read the contents of the file into a variable then manipulate the variable to create the new text. Using the search terms that I already provided, see what you can come up with.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Edit INI file using VBS - 10/21/2008 8:10:51 AM
|
|
 |
|
| |
Rischip
Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
|
There is a small issue with it. They way it is coded it doesn't open unicode files. It needs to be modified to open as a text stream.
_____________________________
Rischip Author of - The Grim Linker
|
|
| |
|
|
|
|
|