0

I have the code below

if (LCase(Config_(C_))) like "show*" Then
crt.screen.send Config_(C_) & VBCR
crt.screen.WaitForStrings ">", "#"
End If

but when I run it I get a "Sub not defined on line 36 (which is the "if(LCase(....." line)

Config_ is an array of strings C_ is the element address

So all I want to do is say,

If this array element starts with "show" then run the command, insuring it does not matter if the user emters upper or lower case.

Why this code does not work? Other if like statements seem ok.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
DevilWAH
  • 2,553
  • 13
  • 41
  • 57

2 Answers2

3

As far as I'm aware, there's no like statement in vbscript. You could use Left which will return n number of characters at the start of a string and see if the string it return equals "show" -

if Left(LCase(Config_(C_)),4) = "show" Then
ipr101
  • 24,096
  • 8
  • 59
  • 61
  • Ahh that will be it then! I have been playing with VBA for last few months, and must have been thinking of that when I say it worked for other cases. Thank you for the example code :) – DevilWAH Nov 02 '11 at 11:30
1

The work "LIKE" is not a key word or a function in vbscript

John Sobolewski
  • 4,512
  • 1
  • 20
  • 26