{"id":71693,"date":"2004-08-09T12:43:00","date_gmt":"2004-08-09T12:43:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2004\/08\/09\/can-i-enable-the-caps-lock-key\/"},"modified":"2004-08-09T12:43:00","modified_gmt":"2004-08-09T12:43:00","slug":"can-i-enable-the-caps-lock-key","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/can-i-enable-the-caps-lock-key\/","title":{"rendered":"Can I Enable the Caps Lock Key?"},"content":{"rendered":"<p><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"><\/p>\n<p>Hey, 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, \u201cPlease make sure the Caps Lock key is on before entering the information.\u201d They don\u2019t always do that, however. Is there a way to turn the Caps Lock key on and off using a script?<\/p>\n<p>&#8212; BW, Medford, OR<\/p>\n<p><img decoding=\"async\" border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><a href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><img decoding=\"async\" class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/a><\/p>\n<p>Hey, BW. We don\u2019t know of a way to turn the Caps Lock key on and off, but we <i>do<\/i> 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:<\/p>\n<pre class=\"codeSample\">this is my sentence.\n<\/pre>\n<p>But Caps Lock will make it appear on screen like this:<\/p>\n<pre class=\"codeSample\">THIS IS MY SENTENCE.\n<\/pre>\n<p>So how can we achieve the same affect in a script? Simple: we just use the VBScript function UCase, which switches all the letters in a string to their uppercase equivalent. For example, here\u2019s 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:<\/p>\n<pre class=\"codeSample\">strMessage = InputBox(\"Please enter your message:\")\nWscript.Echo UCase(strMessage)\n<\/pre>\n<p>Incidentally, the above script doesn\u2019t actually change the case of the letters in the string strMessage; it just <i>displays<\/i> them in uppercase. If you really want all the letters converted to uppercase, try this script instead:<\/p>\n<pre class=\"codeSample\">strMessage = UCase(InputBox(\"Please enter your message:\"))\nWscript.Echo strMessage\n<\/pre>\n<p>Looks crazy, but it works.<\/p>\n<p>For more information about the UCase function, see the <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/script56\/html\/vsfctUCase.asp\" target=\"_blank\">VBScript documentation<\/a> on MSDN.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, 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, \u201cPlease make sure the Caps Lock key is on before entering the information.\u201d They don\u2019t always do that, however. Is there a way to turn the [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3,4,21,5],"class_list":["post-71693","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-scripting-guy","tag-scripting-techniques","tag-string-manipulation","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, 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, \u201cPlease make sure the Caps Lock key is on before entering the information.\u201d They don\u2019t always do that, however. Is there a way to turn the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=71693"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71693\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=71693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=71693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=71693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}