Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cscript for VBscript/Replicate object values/ requirements

Status
Not open for further replies.

JV28132

Programmer
Apr 19, 2010
11
US
I am trying to execute the following command from c prompt to get an output of the script test that should echo information to a logfile.

CScript.exe //NoLogo C:\Reike\Reike.vbs > C:\Reike\logfile.txt

the script executes but no output. What needs to be installed to run cscript commands from c:prompt?

Additionally, its important to know that I do not have access to the production data and I need to replicate the objects FAX, EMAIL in order to process correctly. Any advice on how i can replicate this?



Sub Routing_By_RRT_OnLoad()

' On Error Resume Next

Const ForWriting = 2 '// this is a constant that tells the script writer how to open then file
Const ForAppending = 8 '// this is a constant that tells the script writer how to open then file


Dim objFSO '// this will be used to create the file system object
Dim objFileCopy
Dim FileWriter '// this is an object for writing text files


'// ADD YOUR VARIABLES/FIELDS HERE
Dim Fax
Dim Email
Dim Print
Dim StrFilePath
Dim StrFolderPath
Dim StrValue
Dim validEmailTrigger
Dim validFaxTrigger
Dim StrFaxValue
Dim StrEmailValue

StrFilePath = "C:\Reike\script\*.xml"
StrFolderPath = "C:\Reike\script\"
StrEmailValue = "~FRO::%TheEmailAddress%~"
StrFaxValue = "~FRO::%TheFaxNumber%~"


Fax = TheFaxNumber '//Will come from RRT ~FRO::%Fax%~
Email = TheEmailAddress '//Will come from RRT ~FRO::%Email%~
Print = ThePrinter '//Will be if both RRT's are false{blank}

EKOManager.StatusMessage "Fax: " & TheFaxNumber
EKOManager.StatusMessage "Email: " & TheEmailAddress
EKOManager.StatusMessage "Print: " & ThePrinter



strStoragePath1 = "C:\Reike\Fax\" '// Jobs to be Faxed here
EKOManager.StatusMessage "Image Path: " & strStoragePath1

strStoragePath2 = "C:\Reike\Email\" '// Jobs to be emailed here
EKOManager.StatusMessage "Image Path: " & strStoragePath2

strStoragePath3 = "C:\Reike\Print\" '// Jobs to be printed here
EKOManager.StatusMessage "Image Path: " & strStoragePath3

Set objFSO = CreateObject("Scripting.FileSystemObject")' this is where you would use the customer's special COM object instead

' Set Folder = objFSO.CreateFolder(strStoragePath1)

' Set Folder = objFSO.CreateFolder(strStoragePath2)

' Set Folder = objFSO.CreateFolder(strStoragePath3)



If Email = StrEmailValue Then
validEmailTrigger = "True"
Wscript.Echo "Email value is True.", Email
Else
validEmailTrigger = "False"
Wscript.Echo "Email value is False.", Email
End If

If Fax = StrFaxValue Then
validFaxTrigger = "True"
Wscript.Echo "Fax value is True.", Fax
Else
validFaxTrigger = "False"
Wscript.Echo "Fax value is False.", Fax
End If


'Print'
If(validEmailTrigger = "True" ) AND (validFaxTrigger = "True" )Then
WScript.Echo "Display 1"
If objFSO.FolderExists (StrFolderPath )Then
Wscript.Echo "Display 2"
objFSO.MoveFile StrFilePath, strStoragePath3
End If
Else
'Fax'
Wscript.Echo "Display 3"
If validEmailTrigger = "False" Then
Wscript.Echo "Display 4"
If Email = TheEmailAddress Then
Wscript.Echo "Display 5"
If objFSO.FolderExists (StrFolderPath )Then
Wscript.Echo "Display 6"
objFSO.MoveFile StrFilePath, strStoragePath2
End If
End If
Else
'Email'
Wscript.Echo "Display 7"
If validFaxTrigger = "False" Then
Wscript.Echo "Display 8"
If Fax = TheFaxNumber Then
' If objFSO.FolderExists (StrFolderPath )Then
Wscript.Echo "Display 9"
objFSO.MoveFile StrFilePath, strStoragePath1
End If
End If
End If
End If
' End If
End Sub

 
Instead of echoing to the screen, write the info to a file.
Output = "C:\output.txt"
Set filetxt = fs.OpenTextFile(Output,2,true)
filetxt.WriteLine("data")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top