Jump to content

demoniz

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

About demoniz

Profile Information

  • OS
    none specified

demoniz's Achievements

0

Reputation

  1. Hi, I am new on here and was hoping you can help with what I believe is basic problem. I am not a programmer, but chanced my arm at cobbling together some .vbs to help automate a work process. We are a printing company, I tried to write a script (executed by Windows scheduled tasks) to do the following: 1.) check a folder to see if .pdfs had been uploaded via ftp & move them to another folder ("print") 2.) print any .pdfs contained in that "print" folder to default printer (digital printer on site) 3.) delete the files The initial "move files to print" script is as follows: Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.MoveFile "C:\XPC\Output\DocuPrint\*.pdf" , "C:\XPC\Output\DucuPrint_WaitingtoPrint\" The next script (executes shortly after) is as follows: TargetFolder = "C:\XPC\Output\DucuPrint_WaitingtoPrint\" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(TargetFolder) Set colItems = objFolder.Items For i = 0 to colItems.Count - 1 colItems.Item(i).InvokeVerbEx("Print") Next The next "delete files" script is: Dim ObjFso Dim StrSourceLocation Dim StrSourceFileName StrSourceLocation = "C:\XPC\Output\DucuPrint_WaitingtoPrint" StrSourceFileName = "*.pdf" Set ObjFso = CreateObject("Scripting.FileSystemObject") ObjFso.DeleteFile "C:\XPC\Output\DucuPrint_WaitingtoPrint\*.pdf" The problem I am experiencing is when there are no files in these folders and the script executes, a Windows Script Host pop up displays, with the error "file not found" (Code: 800A0035 / Source: Microsoft VBScript runtime error) I know this is extremely basic, however I would be deeply grateful if someone could help me tailor the scripts so we do not receive error pop ups. Many thanks in advance!
×
×
  • Create New...