Hi there,
I am writing the scripts to get subfolders files to send for printing.
Inside my codes, I write the codes to allocate half of the subfolders files
to Printer One and the other half of subfolders files are allocated to
Printer Two.
I am using the subfolders.count property and this given me the total
number of subfolders that I have in the parent folder. I am able to do for
the first half and now I would like to know which is the folder that I
should start from to send for Printer Two.

For instance, total count of the subfolders have 10, therefore I will send
files from subfolder 1 till 5 to Printer 1. And, starts from subfolders no.6
till 10 will send to Printer 2. Now I am stucking at how to continue for
Printer 2. I am wondering whether I can use Item(i) sth like....

cnt = objFolders.Subfolders.Count
i = 1
If cnt <> 0 Then
For Each foldername in objFolders.Subfolders
Set objSubfolders = objFs.Getfolder(foldername.path)
Set objFiles = objSubfolders.Files
'Sends to Printer 1.
For Each filename In objFiles
objFs.CopyFile objSubfolders & "\" & filename.name,
"\\server\Printer1"
Next
If i = Round(objFolders.Subfolders.Count/2,0) Then
Exit For
End If
i = i + 1
Next
End If

I need some advice here, please help. Thanks.

Re: Get subfolders name based on Count no. by name

name
Tue Dec 30 01:26:56 CST 2003

write a regular batch for one printer.

Do not take down two (all) printers in the event.

Explain that thoroughly to you governance.

==========

Stay in business.




"Angela Tiang" <angelatiang@eforms.com.my> wrote in message
news:eIm9oPezDHA.1736@TK2MSFTNGP09.phx.gbl...
> Hi there,
> I am writing the scripts to get subfolders files to send for printing.
> Inside my codes, I write the codes to allocate half of the subfolders
files
> to Printer One and the other half of subfolders files are allocated to
> Printer Two.
> I am using the subfolders.count property and this given me the total
> number of subfolders that I have in the parent folder. I am able to do for
> the first half and now I would like to know which is the folder that I
> should start from to send for Printer Two.
>
> For instance, total count of the subfolders have 10, therefore I will send
> files from subfolder 1 till 5 to Printer 1. And, starts from subfolders
no.6
> till 10 will send to Printer 2. Now I am stucking at how to continue for
> Printer 2. I am wondering whether I can use Item(i) sth like....
>
> cnt = objFolders.Subfolders.Count
> i = 1
> If cnt <> 0 Then
> For Each foldername in objFolders.Subfolders
> Set objSubfolders = objFs.Getfolder(foldername.path)
> Set objFiles = objSubfolders.Files
> 'Sends to Printer 1.
> For Each filename In objFiles
> objFs.CopyFile objSubfolders & "\" & filename.name,
> "\\server\Printer1"
> Next
> If i = Round(objFolders.Subfolders.Count/2,0) Then
> Exit For
> End If
> i = i + 1
> Next
> End If
>
> I need some advice here, please help. Thanks.
>
>


Re: Get subfolders name based on Count no. by Torgeir

Torgeir
Sat Jan 03 14:43:38 CST 2004

Angela Tiang wrote:

> Hi there,
> I am writing the scripts to get subfolders files to send for printing.
> Inside my codes, I write the codes to allocate half of the subfolders files
> to Printer One and the other half of subfolders files are allocated to
> Printer Two.
> I am using the subfolders.count property and this given me the total
> number of subfolders that I have in the parent folder. I am able to do for
> the first half and now I would like to know which is the folder that I
> should start from to send for Printer Two.
>
> For instance, total count of the subfolders have 10, therefore I will send
> files from subfolder 1 till 5 to Printer 1. And, starts from subfolders no.6
> till 10 will send to Printer 2. Now I am stucking at how to continue for
> Printer 2. I am wondering whether I can use Item(i) sth like....

Hi

Change the printer name inside the For Each loop instead, something like this:


cnt = objFolders.Subfolders.Count
i = 1
If cnt <> 0 Then
For Each foldername in objFolders.Subfolders
If i > Round(objFolders.Subfolders.Count/2,0) Then
strPrinter = "\\server\Printer2"
Else
strPrinter = "\\server\Printer1"
End If

Set objSubfolders = objFs.Getfolder(foldername.path)
Set objFiles = objSubfolders.Files

For Each filename In objFiles
objFs.CopyFile objSubfolders & "\" & filename.name, strPrinter
Next
i = i + 1
Next
End If




--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: Get subfolders name based on Count no. by Angela

Angela
Mon Jan 05 01:43:36 CST 2004

thank you so much!!!
how come I never thought of that...

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FF7297A.75713C03@hydro.com...
> Angela Tiang wrote:
>
> > Hi there,
> > I am writing the scripts to get subfolders files to send for
printing.
> > Inside my codes, I write the codes to allocate half of the subfolders
files
> > to Printer One and the other half of subfolders files are allocated to
> > Printer Two.
> > I am using the subfolders.count property and this given me the total
> > number of subfolders that I have in the parent folder. I am able to do
for
> > the first half and now I would like to know which is the folder that I
> > should start from to send for Printer Two.
> >
> > For instance, total count of the subfolders have 10, therefore I will
send
> > files from subfolder 1 till 5 to Printer 1. And, starts from subfolders
no.6
> > till 10 will send to Printer 2. Now I am stucking at how to continue for
> > Printer 2. I am wondering whether I can use Item(i) sth like....
>
> Hi
>
> Change the printer name inside the For Each loop instead, something like
this:
>
>
> cnt = objFolders.Subfolders.Count
> i = 1
> If cnt <> 0 Then
> For Each foldername in objFolders.Subfolders
> If i > Round(objFolders.Subfolders.Count/2,0) Then
> strPrinter = "\\server\Printer2"
> Else
> strPrinter = "\\server\Printer1"
> End If
>
> Set objSubfolders = objFs.Getfolder(foldername.path)
> Set objFiles = objSubfolders.Files
>
> For Each filename In objFiles
> objFs.CopyFile objSubfolders & "\" & filename.name, strPrinter
> Next
> i = i + 1
> Next
> End If
>
>
>
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>