用vbscript實(shí)現(xiàn)啟用 Caps Lock (大寫(xiě))鍵
更新時(shí)間:2007年04月07日 00:00:00 作者:
問(wèn):
嗨,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?簡(jiǎn)單: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.
嗨,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?簡(jiǎn)單: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.
相關(guān)文章
用vbs記錄屏幕保護(hù)程序的開(kāi)始時(shí)間和結(jié)束時(shí)間
用vbs記錄屏幕保護(hù)程序的開(kāi)始時(shí)間和結(jié)束時(shí)間...2007-03-03Vbs腳本實(shí)現(xiàn)radmin終極后門(mén)代碼_刪除自身
在網(wǎng)上看到N多人做radmin后門(mén),要導(dǎo)出注冊(cè)表而且還用被殺軟件K殺。所以本人把自己寫(xiě)的腳本提供大家分享。比較實(shí)用,希望大家喜歡。2008-06-06vbs 腳本錯(cuò)誤:操作中文件名或類(lèi)名未找到的解決方法
昨天下午閑得無(wú)事,于是翻出以前的腳本,嘗試運(yùn)行,結(jié)果卻出現(xiàn)了如圖所示的錯(cuò)誤2013-07-07使用vbs腳本實(shí)現(xiàn)自動(dòng)打字祝福與搞笑實(shí)現(xiàn)代碼
聽(tīng)說(shuō)抖音上流行一種用代碼做程序表白的東西,其實(shí)很多vbs愛(ài)好者喜歡玩的東西,這里為大家分享一下,需要的朋友可以參考下2019-09-09使用腳本調(diào)用系統(tǒng)的關(guān)機(jī)對(duì)話(huà)框?qū)崿F(xiàn)代碼
以前有介紹如何使用命令行調(diào)用系統(tǒng)的關(guān)機(jī)對(duì)話(huà)框rundll32.exe shell32.dll #60,但是,上述方法會(huì)存在一問(wèn)題,XP下無(wú)法正常使用該方法進(jìn)行關(guān)機(jī)2012-05-05vbs qq自動(dòng)發(fā)信息增強(qiáng)版
這篇文章主要介紹了vbs qq自動(dòng)發(fā)信息增強(qiáng)版,需要的朋友可以參考下2014-05-05