VB 脚本 if 语句:Sub 未定义

发布于 2024-12-13 09:33:40 字数 421 浏览 8 评论 0原文

我有下面的代码

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

,但当我运行它时,我得到一个“Sub not Define on line 36”(即“if(LCase(.....”行)

Config_ is an array of strings) C_ 是元素地址

所以我想做的就是说,

如果这个数组元素以“show”开头,则运行命令,确保用户输入大写或小写都没关系。

为什么这段代码不起作用?其他 if like 语句似乎还可以。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝眸 2024-12-20 09:33:41

据我所知,vbscript 中没有 like 语句。您可以使用 Left 它将在字符串开头返回 n 个字符,并查看它返回的字符串是否等于“show” -

if Left(LCase(Config_(C_)),4) = "show" Then

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
温柔戏命师 2024-12-20 09:33:41

作品“LIKE”不是 vbscript 中的关键字或函数

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文