首页脚本用vbscript实现启用 Caps Lock (大写)键

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

时间2024-02-11 08:42:03发布访客分类脚本浏览117
导读:收集整理的这篇文章主要介绍了用vbscript实现启用 Caps Lock (大写)键,觉得挺不错的,现在分享给大家,也给大家做个参考。 问: 嗨,Scripting Guy!I hav...
收集整理的这篇文章主要介绍了用vbscript实现启用 Caps Lock (大写)键,觉得挺不错的,现在分享给大家,也给大家做个参考。 问:
嗨,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.

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: 用vbscript实现启用 Caps Lock (大写)键
本文地址: https://pptw.com/jishu/609573.html
用vbscript实现从后到前阅读一个文本文件 vbscript和javascript版的15位, 18位的身份证号码的验证函数.以及根据身份证取省份,生日,性别

游客 回复需填写必要信息