From: OldDog on
Hi,

I have found several examples of scripts that use this:
"objItem.InvokeVerbEx("Print")" to print text files.
However, when I use it, I get a dialog box for every single file
printed with the date/time and an OK button.

This is really anoying if you have hundreds of files to Print. I have
seen the issue brought up before, but no answer to the question. I did
try to send it to NUL objItem.InvokeVerbEx("Print") > NULL but that
did nothing at all.

Is there a way to print all the text files in a directory with out
having to click OK 100 times?

My Code:

TargetFolder = "C:\Temp"
Set objShell = CreateObject("Shell.Application")
statval.value = statval.value & TargetFolder & VbCrLf
Set objFolder = objShell.Namespace(TargetFolder)
Set colItems = objFolder.Items
For Each objItem in colItems
objItem.InvokeVerbEx("Print")
Next



OLDDOG
From: Tom Lavedas on
On May 27, 11:24 pm, OldDog <mikef2...(a)comcast.net> wrote:
> Hi,
>
> I have found several examples of scripts that use this:
> "objItem.InvokeVerbEx("Print")" to print text files.
> However, when I use it, I get a dialog box for every single file
> printed with the date/time and an OK button.
>
> This is really anoying if you have hundreds of files to Print. I have
> seen the issue brought up before, but no answer to the question. I
> did
> try to send it to NUL   objItem.InvokeVerbEx("Print") > NULL but that
> did nothing at all.
>
> Is there a way to print all the text files in a directory with out
> having to click OK 100 times?
>
> My Code:
>
> TargetFolder = "C:\Temp"
> Set objShell = CreateObject("Shell.Application")
> Set objFolder = objShell.Namespace(TargetFolder)
> Set colItems = objFolder.Items
> For Each objItem in colItems
>     objItem.InvokeVerbEx("Print")
> Next
>
> OLDDOG

That's not what happens on my machine when I use your code. Since
your code is just invoking the verb of the program that is performing
the Print, through OLE I think, it is not a code problem. What
program is invoked for the Print command when you perform the
operation manually from the right-click context menu for the text file
in question? Does the manual operation require the same OK
confirmation? I suspect that it does, and that it is a setting in
that program that is causing your dilemma. Track that down and get it
to print without confirmation and that should fix the problem.
_____________________
Tom Lavedas
From: OldDog on
On May 28, 7:31 am, Tom Lavedas <tglba...(a)verizon.net> wrote:
> On May 27, 11:24 pm, OldDog <mikef2...(a)comcast.net> wrote:
>
>
>
>
>
> > Hi,
>
> > I have found several examples of scripts that use this:
> > "objItem.InvokeVerbEx("Print")" to print text files.
> > However, when I use it, I get a dialog box for every single file
> > printed with the date/time and an OK button.
>
> > This is really anoying if you have hundreds of files to Print. I have
> > seen the issue brought up before, but no answer to the question. I
> > did
> > try to send it to NUL   objItem.InvokeVerbEx("Print") > NULL but that
> > did nothing at all.
>
> > Is there a way to print all the text files in a directory with out
> > having to click OK 100 times?
>
> > My Code:
>
> > TargetFolder = "C:\Temp"
> > Set objShell = CreateObject("Shell.Application")
> > Set objFolder = objShell.Namespace(TargetFolder)
> > Set colItems = objFolder.Items
> > For Each objItem in colItems
> >     objItem.InvokeVerbEx("Print")
> > Next
>
> > OLDDOG
>
> That's not what happens on my machine when I use your code.  Since
> your code is just invoking the verb of the program that is performing
> the Print, through OLE I think, it is not a code problem.  What
> program is invoked for the Print command when you perform the
> operation manually from the right-click context menu for the text file
> in question?  Does the manual operation require the same OK
> confirmation?  I suspect that it does, and that it is a setting in
> that program that is causing your dilemma.  Track that down and get it
> to print without confirmation and that should fix the problem.
> _____________________
> Tom Lavedas- Hide quoted text -
>
> - Show quoted text -

Tried it on a diferent machine and had no problem. Thanks for the
input.