Login | |
|
 |
Reading from a file, and writing to a container - 3/26/2007 5:27:49 AM
|
|
 |
|
| |
zokissima
Posts: 13
Score: 0
Joined: 3/26/2007
Status: offline
|
Hi all Total n00b here, so if I may be forgiven any transgressions, I'd really appreciate any help I can get. I've just been muddling through, did a few searches, and found some useful stuff, but I just don't have the knowledge to put it all together. Basically, I need to construct a script that will read the contents of one text file, and write the results into a container within a second text file. This is for the construction of an SMS mif file, which requires a certain format for it to be recognized in a scan. Each of our register machies has an application identifier that is unique to that register, and is what is used in communications. When I give people host names, they just stare at me. So, basically, I have written a CMD program (if it can be called as such :p ) that extracts this id, and pumps it into a text file. It is just a single line of information, ie ID=099 I need to read the contents of this text file into a variable, then output this variable into a totally new text file, but within a specific format. For example, all mif files have a general layout of the following: ATTRIBUTE NAME = "blahblah" ID = 1 TYPE = String(250) VALUE = "ID=099" (notice, it is this that I need to create) END ATTRIBUTE I have muddled around a bit, and found a basic method to read this input (gathered from this very forum) : Dim InputFile Dim FSO, oFile Dim strData InputFile = "C:\IDtest.txt" Set FSO = CreateObject("Scripting.FileSystemObject") Set oFile = FSO.OpenTextFile(InputFile) strData = oFile.ReadAll oFile.Close I also know how to print out lines, one by one. I am just at a loss as to how to print out several pre-determined text strings, then populate the variable, print it, and then proceed with the rest of the pre-determined strings. I hope that this is clear enough. I apologise for the lengthy post, but I'm just in a very tight deadline right now. I would greatly appreciate any assistance you guys/gals can offer :)
|
|
| |
|
|
|
 |
RE: Reading from a file, and writing to a container - 3/26/2007 5:52:54 AM
|
|
 |
|
| |
dm_4ever
Posts: 2359
Score: 36
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Well, that would be your best bet zokissima, the COM object ebgreen mentioned. I can't help with that though...never played with it.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Reading from a file, and writing to a container - 3/26/2007 6:33:37 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
I have only used a portion of the object's functionality to create installation status mifs in the past. Here is some quick code: Dim MIF:Set MIF=CreateObject("ISMIFCOM.InstallStatusMIF") Dim message 'creating status MIF If status = LCase("fail") Then message="Failure Occured - Key value = " & strResult status = 0 Else message="Completed Successfully - Key value = " & strResult status = 1 End If MIF.Create "Status","Some Company Name","Some Installation Name","1.0","1033"," ",""& message&"", status
_____________________________
"... 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
|
|
| |
|
|
|
|
|