Login | |
|
 |
RE: File Creation - 1/4/2006 1:56:20 AM
|
|
 |
|
| |
Cybex
Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
|
I see what you mean. Cybex
_____________________________
Common sense is not so common.
|
|
| |
|
|
|
 |
RE: File Creation - 1/4/2006 9:16:27 PM
|
|
 |
|
| |
Navarre
Posts: 90
Score: 0
Joined: 10/19/2005
Status: offline
|
Here is the code as written, I made a small change to where it outputs the files. I have made it a input box that asks it to specify, next I will look at setting some default information for it. Const adOpenForwardOnly = 0 ' 00000000 Const adLockReadOnly = 1 ' 00000001 Const adCmdTable = 2 ' 00000002 Dim sXLSFSpec : sXLSFSpec = "N:\IT\Asset Register\Security\Store Details.xls" Dim sTblName : sTblName = "[Sheet2$]" Dim sTPLFSpec : sTPLFSpec = ".\commsboth2.000" Dim sOTPDir : sOTPDir = InputBox("Please Enter the Drive Path To Output To. For Example C:\Shops\") Dim oFS : Set oFS = CreateObject( "Scripting.FileSystemObject" ) Dim dicMarkers : Set dicMarkers = CreateObject( "Scripting.Dictionary" ) Dim sText0 : sText0 = oFS.OpenTextFile( sTPLFSpec ).ReadAll() If Not oFS.FolderExists( sOTPDir ) Then oFS.CreateFolder( sOTPDir ) dicMarkers.Add "§HOST§" , "172.27.1.5" dicMarkers.Add "§DomUser§" , "?" dicMarkers.Add "§PassW§" , "?" dicMarkers.Add "§ShopNum§" , "?" dicMarkers.Add "§Country§" , "Oz" dicMarkers.Add "§CountryCode§" , "80" Dim oCNCT : Set oCNCT = CreateObject( "ADODB.Connection" ) Dim oRS : Set oRS = CreateObject( "ADODB.Recordset" ) Dim sCNCT : sCNCT = "Provider=MSDASQL;" _ + "Driver={Microsoft Excel Driver (*.xls)};" _ + "DBQ=" + sXLSFSpec + ";" oCNCT.Open sCNCT oRS.Open sTblName, oCNCT, adOpenForwardOnly, adLockReadOnly, adCmdTable Do While Not oRS.EOF WScript.Echo oRS( "Store" ).Value Dim sShopNum : sShopNum = Left( oRS( "Store" ), 2 ) Dim sOTPDir2 : sOTPDir2 = sOTPDir + sShopNum + "\" If Not oFS.FolderExists( sOTPDir2 ) Then oFS.CreateFolder( sOTPDir2 ) Dim oTSRes : Set oTSRes = oFS.CreateTextFile( sOTPDir2 + "comms.scr" ) Dim sText1 : sText1 = sText0 Dim sKey dicMarkers( "§DomUser§" ) = "gwshop" + sShopNum dicMarkers( "§PassW§" ) = oRS( "Mail" ) dicMarkers( "§ShopNum§" ) = sShopNum dicMarkers( "§Country§" ) = sCountry dicMarkers( "§CountryCode§") = sCountryCode oRS.MoveNext For Each sKey In dicMarkers.Keys sText1 = Replace( sText1, sKey, dicMarkers( sKey ) ) Next oTSRes.Write sText1 oTSRes.Close Loop oCNCT.Close The config file is still the same - open §HOST§ win2000\§DomUser§ §PassW§ bi cd \comms\§Country§ lcd c:\arrow\comms mput arr??r??.xfr cd \comms\§Country§\upload mget ARR??H§CountryCode§.XFR cd \comms\§Country§ lcd c:\arrow\arr@data mput r??-dcom.txt mput r??-ucom.txt lcd c:\data\forms mput ???_w1.xls lcd c:\temp cd \comms\files mget *.* cd \comms\files\§Country§ mget *.* cd \comms\files\§Country§\§ShopNum§ mget *.* quit
|
|
| |
|
|
|
|
|