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

所属分类: 脚本专栏 / vbs 阅读数: 1375
收藏 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.
更多精彩内容其他人还在看

vbs实现恢复暂停的自动启动服务的脚本

有时候我们需要把自启动的服务停掉,方便我们处理事务,但我们如果一次停掉的自启动服务比较多,如何一次性启动他们呢
收藏 0 赞 0 分享

vbs删除注册表项的代码

一般我们删除注册表时这个是另外一个方法,这个是结合系统
收藏 0 赞 0 分享

用vbs检查注册表项的访问权限的代码

有时候我们需要知道我们是否对注册表有访问权限,下面的代码就是解决了这个问题,检查下是否能用vbs修改注册表项
收藏 0 赞 0 分享

vbs之使用Internet Explorer 屏蔽密码

演示如何通过脚本创建 Internet Explorer 的实例,并检索输入密码样式的文本框中的密码。需要带有适当的文本框的 Web 页(名为 password.htm)。
收藏 0 赞 0 分享

vbscript 注册表脚本书写

用vbscript实现的修改注册表的脚本,建议大家看看
收藏 0 赞 0 分享

vbs下通过日期查找文件夹的代码

用vbscript根据日期查找文件,有时候我们需要找指定日期的文件,用下面的代码即可
收藏 0 赞 0 分享

vbs复制文件的脚本

用vbscript实现文件的复制功能,主要用于一般的备份等操作
收藏 0 赞 0 分享

vbs实现计算机重启

用vbscript实现系统的重启,其实就是用vbscript执行系统下的shutdown.exe实现,汗
收藏 0 赞 0 分享

文件备份vbs脚本

vbs实现文件的备份,默认覆盖操作
收藏 0 赞 0 分享

vbs下用一个小方法实现批量添加域用户

在域模式下批量添加域用户就有些困难,下面是一个vbs脚本,在同级目录下用放置一个users.txt的文本文档,格式:username,password,在dc上运行该脚本,即可以将users.txt的用户信息批量添加到ad里面。可以通过移动或拖拽的方法,将生成的用户移动到ou下面
收藏 0 赞 0 分享
查看更多