Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Paginate results of an FSO file list

Reply
 
Old 08-26-2008   #1 (permalink)
i11usive


 
 

Paginate results of an FSO file list

Hi,

I'm using vbscript to display a list of images in a folder. Is it
possible to paginate the results, so that if there are over 50 images
in a folder, I can limit the amount of images shown?

Thanks in advance,

i11

My System SpecsSystem Spec
Old 08-26-2008   #2 (permalink)
Anthony Jones


 
 

Re: Paginate results of an FSO file list


"i11usive" <i11usive007@xxxxxx> wrote in message
news:6bc9e15b-30f4-4f46-96b1-77d001cae03c@xxxxxx
Quote:

> Hi,
>
> I'm using vbscript to display a list of images in a folder. Is it
> possible to paginate the results, so that if there are over 50 images
> in a folder, I can limit the amount of images shown?
>
Probably but we'd need to see some of your code to advise you on how to do
it?
You would also do well to explain how it is you are displaying it, in a
browser? is it a HTA or is this ASP?


--
Anthony Jones - MVP ASP/ASP.NET


My System SpecsSystem Spec
Old 08-26-2008   #3 (permalink)
mayayana


 
 

Re: Paginate results of an FSO file list

As Anthony Jones said, you didn't post enough
information for anyone to offer a specific answer.
Presumably you've got a collection of file names.
A FSO Folder Files collection? Or maybe a
Shell.Application ShellFolder Items collection?
Assuming that you're looping through a collection
with For Each you can add a counter:

Set oFolder = FSO.GetFolder(path)
Set oFiles = oFolder.Files
iCount = 0
For Each oFile in oFiles
If ucase(Right(oFile.Name, 3)) = "JPG" then
'-- code here to add image to display
iCount = iCount + 1
End If
if iCount = 50 then Exit For
Next
Quote:

>
> I'm using vbscript to display a list of images in a folder. Is it
> possible to paginate the results, so that if there are over 50 images
> in a folder, I can limit the amount of images shown?
>
> Thanks in advance,
>
> i11

My System SpecsSystem Spec
Old 08-26-2008   #4 (permalink)
Anthony Jones


 
 

Re: Paginate results of an FSO file list

"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:OmCII33BJHA.3512@xxxxxx
Quote:

> As Anthony Jones said, you didn't post enough
> information for anyone to offer a specific answer.
> Presumably you've got a collection of file names.
> A FSO Folder Files collection? Or maybe a
> Shell.Application ShellFolder Items collection?
> Assuming that you're looping through a collection
> with For Each you can add a counter:
>
> Set oFolder = FSO.GetFolder(path)
> Set oFiles = oFolder.Files
> iCount = 0
> For Each oFile in oFiles
> If ucase(Right(oFile.Name, 3)) = "JPG" then
> '-- code here to add image to display
> iCount = iCount + 1
> End If
> if iCount = 50 then Exit For
> Next
That works for a 'First 50 of' solution but to paginate a solution for 'get
me the next 50' is also needed.

If the display is simply dumping a file list to the console then the above
could be adapted so that the code remains within a single enumeration of
Files. However, if the code is in a HTA displaying as HTML then the
procedure would need to exit and then we'd need a way to start another
enumeration 50 files in.


--
Anthony Jones - MVP ASP/ASP.NET


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
ping results to html file PowerShell
export results to tab-delimited file PowerShell
Echo results of script to file PowerShell
uploading script results to a csv file PowerShell
Vista File Indexing = Incomplete results Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46