用vbscript实现启用 Caps Lock (大写)键

所属分类: 脚本专栏 / vbs 阅读数: 1410
收藏 0 赞 0 分享
问:
嗨,Scripting Guy!I have a script where users enter some information in an Input box.The information needs to be entered in all-capital letters, so my instructions say, “Please make sure the Caps Lock key is on before entering the information.”They don't always do that, however.Is there a way to turn the Caps Lock key on and off using a script?
-- BW, Medford, OR
答:
Hey, BW.We don't know of a way to turn the Caps Lock key on and off, but we do know a way to mimic the effect of having the Caps Lock key on.After all, the whole point of the Caps Lock key is to turn everything you type into uppercase letters.For example, you might type this:
this is my sentence.
But Caps Lock will make it appear on screen like this:
THIS IS MY SENTENCE.
So how can we achieve the same affect in a script?简单:we just use the VBScript function UCase, which switches all the letters in a string to their uppercase equivalent.For example, here's a simple two-line script that gathers information from a user and then uses the UCase function to switch all the letters to uppercase when echoing the value to the screen:
strMessage = InputBox("Please enter your message:")Wscript.Echo UCase(strMessage)
Incidentally, the above script doesn't actually change the case of the letters in the string strMessage; it just displays them in uppercase.If you really want all the letters converted to uppercase, try this script instead:
strMessage = UCase(InputBox("Please enter your message:"))Wscript.Echo strMessage
Looks crazy, but it works.
For more information about the UCase function, see theVBScript 文档 on MSDN.
更多精彩内容其他人还在看

用vbscript来添加ip策略 自动封IP

看过有网友介绍的方法,不过是手工一条一条地封,而攻击IP一般都是数千个不同的IP。用手工封IP的办法太麻烦。下面我们用程序来实现自动封这些IP!
收藏 0 赞 0 分享

vbs,hta中选择文件夹对话框实现代码

在vbs中选择文件夹可以直接调用系统的文件夹对话框
收藏 0 赞 0 分享

WMI 脚本高手不完全手册

要成为WMI脚本高手当要认识一下什么叫WMI啦,下面将介绍一下有关WMI的东西。
收藏 0 赞 0 分享

vbscript语句中“&H”专用于16进制数表示

近段时间在做一个asp的项目,由于数据库里面的字段采用字母“h”开头,在sql语言时就出现了莫名其妙的错误,经过反复的检查,也没查出有错误的地方,整整给折腾了我一天的时间。
收藏 0 赞 0 分享

URL 筛选小工具 提取网页中的超链接地址

这个VBS是用来将一个本地网页中的URL筛选出来并保存在新的网页文件中。当然,只要改变里面的正则表达式,就可以作其他用途了。
收藏 0 赞 0 分享

VBScript 文件操作代码小结

下面是一些vbs下常用到的一些文件操作代码,整理了下方便以后开发使用,提高效率。
收藏 0 赞 0 分享

vbs 错误捕获器,用于捕获内部错误并进行手工处理

vbs中的错误捕获器,用于捕获内部错误并进行手工处理
收藏 0 赞 0 分享

查看SQL状态的vbs(检验SQL SERVER是否在这机器上工作 )

这篇文章主要介绍了查看SQL状态的vbs,主要检验SQL SERVER是否在这机器上工作,需要的朋友可以参考下
收藏 0 赞 0 分享

vbs 字符统计功能模块

TongJi()将上面代码保存为TongJi.vbs,在TongJi.vbs同目录下建立ok.txt文本文件,将你要统计的文本复制到ok.txt中,运行TongJi.vbs即可以统计字数,与word的功能一样。
收藏 0 赞 0 分享

重新安装ie的一个vbs

对于版本有点老,所以建议学习使用,不要随便直接运行。
收藏 0 赞 0 分享
查看更多