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!

The system cannot find the file specified line 133

Status
Not open for further replies.

staann56

IS-IT--Management
Sep 28, 2004
24
US
I can't figure out why I'm getting this error...

The system cannot find the file specified line 133.

Any help would be appreciated...below is my code

Dim objFS
Dim objFSFolder
Dim objFSFiles
Dim objFileObj
Dim objFileOut
Dim objFileIn
Dim objFileTemp

Dim objEmail

Dim intCounter
Dim strMessage
Dim tmpAddressAdd

Dim strFileProcessing
Dim strFileComplete
Dim strFileArchive
Dim strFileDistilled
Dim strFileDistilledLog
Dim objTouch
Dim lngReturn

Dim strDayOfYear
Dim intDayOfYear
Dim intYear
Dim intMonth
Dim intDay

Dim strReportName
Dim intReportNameSize

Dim strReportFacility

Dim objShell
Dim lngResult
Dim strShellCommand

Dim dtDateToCheckFrom
Dim intHour,intMinute,intSecond

Dim strLine
Dim strTemp
Dim intPos

Dim strFilePath
Dim dtFileDate
Dim x

Const intForReading = 1
Const strSearchLabel="CM Query Report:"
Const intPurgeFilesOlderDays=30
Const strCMFilePath_Source = "D:\Report2Web\HC_Reports\Inbound\"
Const strCMFilePath_Processing = "D:\Report2Web\HC_Reports\Processing\"
Const strCMFilePath_Archive = "D:\Report2Web\HC_Reports\Archive\Corporate\"
Const strCMFilePath_Complete = "D:\Report2Web\HC_Reports\Complete\"

Const strAdobeDistillerFilePath="D:\Program Files\Adobe\Acrobat 8.0\Acrobat\acrodist.exe"
Const strAdobeJobOptionsFilePath="D:\Program Files\Adobe\Acrobat 8.0\Acrobat\Settings\HC_Reports"


'*********************************************************************************
'CREATE COMMON OBJECTS
'*********************************************************************************
Set objShell = CreateObject("WScript.Shell")
Set objFS= WScript.CreateObject("Scripting.FileSystemObject")
'Set objTouch = CreateObject("TouchDate.Utilities")

'*********************************************************************************
'DETERMINE IF THERE ARE ANY FILES TO PROCESS
'*********************************************************************************
Set objFSFolder=objFS.GetFolder(strCMFilePath_Source)
Set objFSFiles=objFSFolder.Files

intCounter=0
For Each objFileObj In objFSFiles
'*********************************************************************************
'CALCULATE DAY OF YEAR VARIABLE TO ADD TO PROCESSED FILES
'*********************************************************************************
intYear = DatePart("yyyy",objFileObj.DateLastModified)
intDayOfYear = DatePart("y",objFileObj.DateLastModified)
strDayOfYear="_" & intYear & "_" & intDayOfYear

'*********************************************************************************
'DETERMINE REPORT NAME
'*********************************************************************************
strFileProcessing = strCMFilePath_Source & objFileObj.name

'Read input file
Set objFileIn=objFS.OpenTextFile(strFileProcessing,intForReading)

strReportName=""
Do Until objFileIn.AtEndOfStream
'Read in the next line
strLine = objFileIn.ReadLine

'If on the second line
intPos=InStr(strLine,strSearchLabel)
If intPos > 0 Then
strTemp=Mid(strLine,(intPos + Len(strSearchLabel)))
intPos = InStr(strTemp,")[")
If intPos > 0 Then
strReportName=UCase(Trim(Left(strTemp,intPos-1)))
End If
End If
Loop
Set objFileIn = Nothing

'*********************************************************************************
'FILTER OUT FACILITY NAME AND SET FACILITY VARIABLE
'*********************************************************************************
strReportFacility=""
Select Case Mid(strReportName,4,3)
Case "CH_" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Covenant\"
Case "MMC" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Methodist\"
Case "FSR" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Regional\"
Case "FSP" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Parkwest\"
Case "FSL" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Loudon\"
Case "FSS" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Sevier\"
End Select


'*********************************************************************************
'DISTILLS THE FILE
'*********************************************************************************
strFileDistilled = strCMFilePath_Processing & strReportName & strDayOfYear & ".PDF"
'Run the script
strShellCommand=strAdobeDistillerFilePath & strFileDistilled & " " & strFileProcessing

' D:\Program Files\Adobe\Acrobat 8.0\Acrobat\Settings\HC_Reports /V:eek:ff /Q /N /O " &

msgbox(strAdobeDistillerFilePath & " " & strFileDistilled & " " & strFileProcessing)

lngReturn = objShell.Run (strShellCommand, 1, 1)

'Delete the log file
strFileDistilledLog=strCMFilePath_Processing & strReportName & strDayOfYear & ".LOG"
If objFS.FileExists(strFileDistilledLog) Then
objFS.DeleteFile strFileDistilledLog
End If

'*********************************************************************************
'SET THE DATE MODIFIED TO MATCH THE SOURCE FILE DATE MODIFIED
'*********************************************************************************
strFilePath = strCMFilePath_Processing & strReportName & strDayOfYear & ".PDF"

intYear=Year(objFileObj.DateLastModified)
intMonth=Month(objFileObj.DateLastModified)
intDay=Day(objFileObj.DateLastModified)
dtFileDate = CDate(intMonth & "/" & intDay & "/" & intYear)
' x=objTouch.fnModifyDate(strFilePath, dtFileDate)

'*********************************************************************************
'COPY THE FILE THE ARCHIVE FOLDER
'*********************************************************************************

strFileArchive=strCMFilePath_Archive & strReportFacility & strReportName & strDayOfYear & ".PDF"
objFS.CopyFile strFileDistilled, strFileArchive

'*********************************************************************************
'COPY FILES TO THE COMPLETE FOLDER
'*********************************************************************************

strFileComplete=strCMFilePath_Complete & objFileObj.name
objFS.CopyFile strFileProcessing, strFileComplete

'*********************************************************************************
'DELETE DISTILLED FILE
'*********************************************************************************

objFS.DeleteFile strFileDistilled

'*********************************************************************************
'DELETE PROCESSED FILE
'*********************************************************************************

objFS.DeleteFile strFileProcessing

'*********************************************************************************
'Update file process counter
'*********************************************************************************

intCounter=intCounter+1
Next

'*********************************************************************************
'CLEAN UP COMPLETED FILES OLDER THEN 30 DAYS
'*********************************************************************************
'dtDateToCheckFrom=Now()
'intHour=Hour(dtDateToCheckFrom)
'intMinute=Minute(dtDateToCheckFrom)
'intSecond=Second(dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("h",-(intHour),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("n",-(intMinute),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("s",-(intSecond),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("d",-(intPurgeFilesOlderDays),dtDateToCheckFrom)

'Set objFSFolder=objFS.GetFolder(strCMFilePath_Complete)
'Set objFSFiles=objFSFolder.Files
'For Each objFileObj In objFSFiles
' If objFileObj.DateLastModified < dtDateToCheckFrom Then
' 'Delete the File
' objFS.DeleteFile strCMFilePath_Complete & objFileObj.name
' End If
'Next


'**************************************************
'Email results
'**************************************************
'strMessage = "Reported: " & Now() & "" _
' & "<BR><BR>" _
' & "There were <B>" & intCounter & "</B> CareManager files loaded into Report2Web." _
' & "<BR><BR>" _
' & "Thanks," _
' & "<BR><BR>" _
' & "TaskScheduler on Report2web03"
'Set objMail = CreateObject("Persits.MailSender")
'objMail.Host = "smtp"
'objMail.From = "DoNotReply.com"
'objMail.Subject = "CareManager to Report2Web: Files processed summary"
'objMail.Body = strMessage
'tmpAddressAdd = objMail.AddAddress("email.com")
'tmpAddressAdd = objMail.AddAddress("email.com")
'tmpAddressAdd = objMail.AddAddress("email.com")
'objMail.IsHTML = True
'objMail.Send()
'Set objMail = Nothing

'*********************************************************************************
'CLEAN UP
'*********************************************************************************
Set objFileIn=Nothing
Set objFileOut=Nothing
Set objFileObj=Nothing
Set objFSFiles=Nothing
Set objFSFolder=Nothing
Set objFS=Nothing
Set objASPExec=Nothing
Set objShell = Nothing
Set objFileTemp=Nothing
Set objTouch = Nothing
 
Replace this:
strShellCommand=strAdobeDistillerFilePath & strFileDistilled & " " & strFileProcessing
with this:
strShellCommand=Chr(34) & strAdobeDistillerFilePath & Chr(34) & " " & Chr(34) & strFileDistilled & Chr(34) & " " & Chr(34) & strFileProcessing & Chr(34)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well that got me past the original problem I was having. However, now I get an 'Acrobat Distiller' pop-up window that says:

D:\Report2Web\HC_Reports\Processing\_2007_289.PDF
Cannot open this file.

Please check that the correct path and filename are given.


Thanks for looking,
Stan
 
Please check that the correct path and filename are given
So ?
 
That's the mystery! The path specified is correct but the distiller doesn't see it that way. I'm still working on this trying to figure it out.

Thanks,
Stan
 
OK....I really need help. I'm getting a file not found error on this line:

objFS.CopyFile strFileDistilled, strFileArchive

of the COPY THE FILE THE ARCHIVE FOLDER routine.

Any help would be greatly appreciated.

Thanks
Stan

 
HELP please. I'm still having problems with this line:


objFS.CopyFile strFileDistilled, strFileArchive

I'm getting a file not found error on this line. If anybody can help me with this I'd greatly appreciate it.

Thanks,
HW
 
With my limited knowledge of VBScript, you probably need to specify the full path where the file defined as strFileDistilled is. You are probably getting file not found because the path is not specified.

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
Having not read the script, you sure can wscript.echo those two strings and inspect what they are before the line of copyfile. There is not much more to debug such kind of error. What are they?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top