Printing all items in a folder.

  • Thread starter Thread starter Jaz
  • Start date Start date
J

Jaz

We have a situation where we need to print all files that are in a folder.
The user would put a number in a prompt that appears. The number would
correlate to a specific folder and print all items in that folder. The
folder would consists of word, excel, PDF's and certain images.

All I really need is the right command(s) to print the items in the folder.

Is there command, script or third party software that can accomplish this?

Any suggestions would be appreciated!

Thanks,
Jasper
 
Below is the code to print all files of a given extension. Assuming all of
the files in the folder have an application associated with it that supports
the Print Verb, meaning that you can Right-Click the file and "Print" is on
of the chooses, then you could do away with the Extension check.



sEXT = "txt"
sFdr = "D:\Scripts\Inventory\Reports"

Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
Set oFsFdr = oFS.GetFolder(sFdr)

Set oShellApp = CreateObject("Shell.Application")
Set oShFdr = oShellApp.Namespace(sFdr)

For Each oFile In oFsFdr.Files
If UCase(oFS.GetExtensionName(oFile.Name)) = uCase(sExt) Then
oShFdr.ParseName(oFile.Name).InvokeVerb("&Print")
End If
Next
 
We have a situation where we need to print all files that are in a folder.
The user would put a number in a prompt that appears. The number would
correlate to a specific folder and print all items in that folder. The
folder would consists of word, excel, PDF's and certain images.

All I really need is the right command(s) to print the items in the folder.

Is there command, script or third party software that can accomplish this?

Any suggestions would be appreciated!

Thanks,
Jasper

One way this can be done is using the Shell.Application, using a
Michael Harris example of yor ...

sFolder=Inputbox("folder Name")
set shApp = createobject("shell.application")
set shFolder = shApp.namespace(sFolder)
set shItems = shFolder.Items()
for each shItem in shItems
shItem.invokeverb "&Print"
next

This has no error handling in the case that the folder does not exist
or is empty, but you only wanted the print part.

Note that the &Print is language dependent and therefore must match
the setting found when a file is right-clicked.

Tom Lavedas
===========
 
Back
Top