Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-16-2008, 12:59 PM
nordan nordan is offline
Junior Member
 
Join Date: Jul 2008
Posts: 1
nordan is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Lightbulb How to add elements in my VBscript

Hi,

Im new at scripting VBscript and I have trouble with the script seen further down. What I want to do is store all the filenames that has the word "CSS" in them, but I cant get it to store in the array! Does anyone have any suggestions please?

best regards
Anders

Dim FolderPath
Dim objFSO
Dim objFolder
Dim colFiles
Dim colFile
Dim objFile
Dim searchString
Dim found
Dim InstrReturn
Dim array1
Dim i
Dim j
i = 0

searchString = "CSS"

FolderPath = "D:\E-books\HTML, CSS, AJAX and Javascript Books 2007"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FolderPath)
Set colFiles = objFolder.Files

For Each objFile in colFiles

searchString = "CSS"
found = objFile.Name
InstrReturn = InStr(found, searchString)

if InstrReturn <> 0 Then
array1(i) =+ array(found)
i = i + 1
end if

Next
For j = 0 to UBound (array1)
Wscript.echo array1(j)
Next
Reply With Quote

This ad is part of our Revenue Sharing program
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:00 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

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