I am not sure if this forum is usable for VB Script or if anyone uses it here. I'm hoping so as this is where I'm going to post.
So, I have a job directory (W:\ACAD Jobs\2011 Projects\...) where I have several design firms (sub-folders) listed.
I have several sub-folders of the same design firm but different locations. An example: (I will keep the names ficticious for embarassment sake)
W:\ACAD Jobs\2011 Projects\Design Firm -Alabama
W:\ACAD Jobs\2011 Projects\Design Firm -Washington
W:\ACAD Jobs\2011 Projects\Design Firm -Arizona
I want to search for the name "Design Firm" and assign the full name to a variable for display purposes. So, I need to search for "Design Firm" and have Var_A store "Design Firm -Alabama", Var_B store "Design Firm - Washington", and Var_C store "Design Firm -Arizona".
According to my trusty O'reilly Pocket reference, I should be able to use the \b switch to search for a word in a sentence (a wildcard if you will).
Regular Expression Character Reference
\b Matches a word boundary, that is, the position between a word and a space.
Can someone tell me what this means?
Also, If I have a search for "Design Firm", how would I put in the switch to find any anomolous folders such as "Design Firm -Arizona"?
Here's a piece of code I currently have (perhaps I am looking at this the wrong way. If so, please advise):
cTitle = "Test run"
Set FSO = CreateObject("Scripting.FileSystemObject")
str2011dir = "W:\ACAD JOBS\2011 Projects\"
strDF = InputBox("Design Firm Name: ", cTitle, "Design Firm")
strDFm = "\b " & strDF [color=maroon]' Normally, the switch would go to the front of the string right?[/color]
MsgBox "Input is -" & strDfm,, cTitle [color=maroon]' This is here to show me what the string consists of.[/color]
If FSO.FolderExists(str2011dir & strDFm) Then
MsgBox "The folder " & UCase(strDF) & " exists.",, cTitle
Else
MsgBox "No folder found",, cTitle
End If
EDIT: According to MS <http://msdn.microsoft.com/en-us/library/ms974570.aspx>
\b - Matches any word boundary
"ly\b" matches "ly" in "possibly tomorrow."
So my code
strDF = InputBox("Design Firm Name: ", cTitle, "Design Firm")
strDFm = strDF & "\b"
MsgBox "Input is -" & strDfm,, cTitle
The message box should be displaying "Design Firm\b" so my search should be finding anything with "Firm" in it correct? But it isn't
.