Re: compound if problem
From: learner (ReplytoNewsGroupOnlyPls_at_NoMail.net)
Date: 05/14/04
- Next message: nnever: "Re: how to substitute XMLHTTP?"
- Previous message: tomthumbkop: "Re: Regular Expression & Password"
- In reply to: GoGoGadgetScott: "Re: compound if problem"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 May 2004 15:13:42 -0600
you definitely have a point there. My example pattern is just a simple one
albeit incorrect in terms of regular expression.
I should have the script change that *.xyz to .xyz
the gold is to allow any file patterns to entered and selected
I am just about to give up with the scripts. I thought it would a simple
exercise and learn vbscript to make a little utility for viewing selected
scanned files and let the user change the file names.
I end up with all sort unexpected results. For example, input box that
disappears in a couple of seconds, scripts dying unexpectedly without any
message. I did not have any problem like this with vbs until I started
using regexp in this exercise.
"GoGoGadgetScott" <gogogadgetscott@hotmail.com> wrote in message
news:opr70apkk09xhenz@onthego...
What is the goal? First, the pattern is invalid. Try using just ".xyz".
Also remove any On error statments the would prevent rasie the error
(Unexpected quantifer).
'*' Matches the preceding character zero or more times. For example, "zo*"
matches either "z" or "zoo".
If you would like to check if file has a given extention, use one of the
following methods:
If Right(file.name, 4) = ".xyz" Then MsgBox "True"
or
Patrn = ".xyz$"
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Pattern = Patrn
If myRegExp.test(file.name) Then MsgBox "True"
'Pattern reference
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/h
tml/vspropattern.asp
On Fri, 14 May 2004 11:00:36 -0600, learner
<ReplytoNewsGroupOnlyPls@NoMail.net> wrote:
> Dim File, SubFolder, myRegExp, PatrnSfx, Patrn
>
> Patrn = "*.xyz"
> Set myRegExp = New RegExp
> myRegExp.IgnoreCase = True
> myRegExp.Pattern = Patrn
> PatrnSfx =right(Patrn,4)
>
>
> ' --------- does NOT work :::::
> If (right(file.name,4) = right(Patrn ) ) And myRegExp.test(file.name)
> Then
> ' always evaluates to true
>
> I had to work around with
> if ( right(File.name,4) <> PatrnSfx ) then
> ' nothing
> elseIf ( myRegExp.Test(File.name) ) then
> ................
>
>
>
> does anyone know if there is a fix besides the above?
>
>
> I am using verion 5.6 on XP pro
>
>
>
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
- Next message: nnever: "Re: how to substitute XMLHTTP?"
- Previous message: tomthumbkop: "Re: Regular Expression & Password"
- In reply to: GoGoGadgetScott: "Re: compound if problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|