I have this script that will move all *.pdf files from a folder to a specific location. The script is as follows: It executes on Load and I can get it to work via Visual studio editor (stepping through) but when the vbscript runs, it does not work.. If anyone can understand why, please please forward your thoughts. Thanks,
Code:
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
StrFilePath = "C:\AC\Work\*.pdf"
StrFolderPath = "C:\AC\Work\"
StrEmailValue = "~FRO::%Email1%~"
StrFaxValue = "~FRO::%Fax%~"
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"
Else
validEmailTrigger = "False"
End If
If Email = StrFaxValue Then
validFaxTrigger = "True"
Else
validFaxTrigger = "False"
End If
'Print'
If(validEmailTrigger = "True" ) AND (validFaxTrigger = "True" )Then
If objFSO.FolderExists (StrFolderPath )Then
objFSO.MoveFile StrFilePath, strStoragePath3
End If
Else
'Fax'
If validEmailTrigger = "False" Then
If Email = TheEmailAddress Then
If objFSO.FolderExists (StrFolderPath )Then
objFSO.MoveFile StrFilePath, strStoragePath2
End If
End If
Else
'Email'
If validFaxTrigger = "False" Then
If Fax = TheFaxAddress Then
If objFSO.FolderExists (StrFolderPath )Then
objFSO.MoveFile StrFilePath, strStoragePath1
End If
End If
End If
End If
End If