Thursday, June 24, 2010
How to Convert Keyboard Lights into Disco Lights ?
[ INTRODUCTION ] :
As Everyone knows there are three led lights in almost all computer keyboards.These lights are the status lights for NUM LOCK, CAPS LOCK and SCROLL LOCK respectively.
We'll switch ON and OFF these status lights so fast and in such a fashion that they will appear to be dancing as DISCO LIGHTS do...
For doing this, VBSCRIPT(VisualBasicScript) would be the easiest one. now just follow the steps->
[ CODING ] :
[step.1] copy-paste the following command in notepad(or any text editor)
Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}"
wscript.sleep 80
wshshell.sendkeys "{NUMLOCK}"
wscript.sleep 50
wshshell.sendkeys "{SCROLLLOCK}"
loop
[step.2] now save this file as AnyName.vbs
NOTE : EXTENSION OF FILE SHOULD BE .vbs only
[step.3] now RUN this file and you are done
[ HOW TO STOP ? ] :
Go to
->task manager
->PROCESSES tab
->find WSCRIPT.EXE
->Press End Process
hopefully the script will stop !
[ GET MORE OUT OF THIS CODE ] :
->we can change the value for sleep accordingly, to let the lights dance with our rythm.
->we can run this script many a times simultaneously to intensify it's results.
->run it while CHATTING , it will look cool to the other person.(laptop users may customise the script so that only capslock switch on and off instead of all three)
->ADVANCED(for programers) : you can modify this script to send key strokes to specific applications,create shortcuts,modify registry and much more.For reference u may go to http://msdn.microsoft.com/en-us/library/at5ydy31%28VS.85%29.aspx
[ WHAT IS SCROLL LOCK ] :
Scroll Lock was intended to modify the behavior of the arrow keys. When the Scroll Lock mode was on, the arrow keys would scroll the contents of a text window instead of moving the cursor.Today, this particular use of Scroll Lock is rare. Only a few modern programs still honor this behavior, such as Microsoft Excel.
[ WORKING ] :
->The WScript object is the root object of the Windows Script Host object model hierarchY.
->It exposes some of the common shell functionalities of Microsoft Windows. and one of them is to press the keys virtually or logically,which we have used here.
->The WshShell object is not instantiated automatically upon script execution, hence it must be instantiated explicitly using CreateObject before it can be used.
->Then loop is used to let the script execute infinitely until it is stopped by some external ways.
->In loop sleep is used which Suspends script execution for a specified length of time and then continues execution.
->sendkeys is mainly responsible for keystrokes(virtualy).
->we switch on and off the lock keys with some specified delay such that the keys are on for different time limit which seems like dancing lights.
*********************************************************************************
[ END ]
*********************************************************************************
Subscribe to:
Post Comments (Atom)
7 comments:
are i opened that file afterwards in notepad..
now it opens in notepad and dsnt executes the command...
check the extension of file may be u have changed it accidently...
naa extensions same .vbs
u must have altered the open with deafult program option to notepad.
so to change it back to microsoft windows based script host.
then it will work perfectly
awesome thnx dude it wrkd...
awesome dude,,,,,nice work!!!!!!!!
cool buddy...its great...nice use of shell scripting,i must say...keep it up
Post a Comment