Printing all items in a folder.

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
 
H

Harvey Colwell

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
 
T

Tom Lavedas

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
===========
 
R

rod

Just in case.............
if you have ACDSee, CTRL G will "generate a file listing"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top