WhiteAvenger Posted November 9, 2008 Share Posted November 9, 2008 Hi, is it possible to flash the NumLock light on my laptop? I remember that an MSN Messnger Plus! script had the option to flash the NumLk and ScrlLk lights to alert you of new messages. But is it possible in AutoIt? Thanks, --WhiteAvenger Link to comment Share on other sites More sharing options...
bluerein Posted November 9, 2008 Share Posted November 9, 2008 while 1 send("{NUMLOCK}") sleep(100) wend Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 10, 2008 Share Posted November 10, 2008 Hi, is it possible to flash the NumLock light on my laptop? I remember that an MSN Messnger Plus! script had the option to flash the NumLk and ScrlLk lights to alert you of new messages. But is it possible in AutoIt? Thanks, --WhiteAvenger Kind of overkill, but I had to look up how to check the original state of the NUMLOCK before toggling it, and that lead me a useful idea for flashing the LED. Behold, the _SendMorse() UDF: expandcollapse popupWhile 1 $sInput = InputBox("Morse Code", "Enter string to send: ") If @error Then ExitLoop If _SendMorse($sInput) = 0 Then MsgBox(16, "Error", "_SendMorse() returned 0 (error)" & @CRLF & _ "@error = " & @error & @CRLF & _ "@extended = " & @extended) EndIf WEnd ; ------------------------------------------------------------------- ; Function: _SendMorse ; Purpose: Sends morse code by beeps and flashing NUMLOCK ; Syntax: _SendMorse($sString [, $iBaseTime]) ; Where: $sString = ASCII string to send ; $iBaseTime = Base time for speed, default = 50 (miliseconds) ; Return: On success returns 1. ; On failure returns 0 and sets @error: ; 1 = Input is not ASCII ; 2 = Input has invalid ASCII characters (@extended = count) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Date/Version: 11/10/2008 -- v1.0.0 ; Remarks: String must be all ASCII characters. ; Valid ASCII characters are 0 thru 9, A thru Z, and the following ; puctuation: !"$&'()+,-./:;=?@_ ; Invalid ASCII is not sent and increments the count returned in @extended with @error = 2 ; Special codes can be included for "Procodes" but must be separated by a space from other text: ; "\EOW" = End Of Work ; "\ERROR" = Error ; "\ITT" = Invite To Transmit ; "\START" = Starting Signal ; "\UND" = Understood ; "\WAIT" = Wait ; Example: _SendMorse("\START This is a test. \EOW", 100) ; ------------------------------------------------------------------- Func _SendMorse($sString, $iBaseTime = 50) ; Only handle ASCII strings, only upper case letters If StringIsASCII($sString) Then $sString = StringUpper($sString) Else ; Non-ASCII characters in string Return SetError(1, 0, 0) EndIf ; Declare local variables Local $avRET, $fNUMLOCK Local $avTxWords[1] = [0], $avTxChar[1] = [0], $sTX = "", $iErrCnt = 0 Local $iDahTime = 3 * $iBaseTime; Length of "Dah" Local $iDitTime = $iBaseTime; Length of "Dit" Local $iDahDitGap = $iBaseTime; Gap between Dahs and Dits Local $iCharGap = 3 * $iBaseTime; Gap between characters Local $iWordGap = 7 * $iBaseTime; Gap between words ; Save NUMLOCK state and turn it off $avRET = DllCall('user32.dll', "short", "GetKeyState", "int", '0x90') If Not @error And BitAND($avRET[0], 0xFF) = 1 Then $fNUMLOCK = True Send("{NUMLOCK OFF}") Else $fNUMLOCK = False EndIf ; ------------------------------------------------------------------- ; Declare Morse Code Table ; "-" = Dah, "." = Dit ; Valid ASCII codes are 33 to 95 ; Element index is ASCII code minus 33, so: ; [0] = "-.-.--" = ASCII 33 (Exclamation point) ; [15] = "" = ASCII 48 (Zero) ; [24] = "" = ASCII 57 (Nine) ; [32] = "" = ASCII 65 (A) ; [57] = "" = ASCII 90 (Z) ; [62] = "--.." = ASCII 95 (Underscore) ; Invalid characters (ASCII 35, 37, 42, 60, 62, 91 to 94) return -1 ; ------------------------------------------------------------------- Local $avMorseCode[63] = ["-.-.--", ".-..-.", -1, "...-..-", -1, ".-...", ".----.", _ "-.--.", "-.--.-", -1, ".-.-.", "--..--", "-....-", ".-.-.-", "-..-.", _ "-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", _ "---..", "----.", "---...", "-.-.-.", -1, "-...-", -1, "..--..", ".--.-.", _ ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", _ "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", _ "..-", "...-", ".--", "-..-", "-.--", "--..", -1, -1, -1, -1, "..--.-"] ; Split input string into words $avTxWords = StringSplit($sString, " ") ; For each word... For $w = 1 To $avTxWords[0] ; Check for Procodes Switch $avTxWords[$w] Case "\EOW"; End Of Work $sTX &= "...-.-" & "," Case "\ERROR"; Error $sTX &= "........" & "," Case "\ITT"; Invite To Transmit $sTX &= "-.-" & "," Case "\START"; Starting Signal $sTX &= "-.-.-" & "," Case "\UND"; Understood $sTX &= "...-." & "," Case "\WAIT"; Wait $sTX &= ".-..." & "," Case Else; All other words ; Split work into characters $avTxChar = StringSplit($avTxWords[$w], "") ; For each character... For $c = 1 To $avTxChar[0] $iAsc = Asc($avTxChar[$c]) If ($iAsc >= 33) And ($iAsc <= 122) Then ; Valid ASCII characters If $avMorseCode[$iAsc - 33] <> -1 Then ; Add dah-dit code to string $sTX &= $avMorseCode[$iAsc - 33] & "," Else ; Invalid ASCII character from table $iErrCnt += 1 ContinueLoop EndIf Else ; Invalid ASCII characters $iErrCnt += 1 ContinueLoop EndIf Next EndSwitch $sTX &= " "; Add inter-word gap Next ; Split assembled morse code string: ; "-" = Dah ; "." = Dit ; "," = Inter-character gap ; " " = Inter-word gap $avTxCode = StringSplit($sTX, "") ; Send code For $n = 1 To $avTxCode[0] Switch $avTxCode[$n] Case "-" ; Dah Send("{NUMLOCK ON}") Beep(2000, $iDahTime) Send("{NUMLOCK OFF}") Sleep($iDahDitGap) Case "." ; Dit Send("{NUMLOCK ON}") Beep(2500, $iDitTime) Send("{NUMLOCK OFF}") Sleep($iDahDitGap) Case "," ; Character gap Sleep($iCharGap) Case " " ; Word gap Sleep($iWordGap) EndSwitch Next ; Restore saved NUMLOCK state If $fNUMLOCK Then Send("{NUMLOCK ON}") ; Return result If $iErrCnt Then ; Invalid ASCII characters in string Return SetError(2, $iErrCnt, 0) Else Return 1 EndIf EndFunc ;==>_SendMorse Func _Quit() Send("{NUMLOCK ON}") Exit EndFunc ;==>_Quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
monoceres Posted November 10, 2008 Share Posted November 10, 2008 I have an UDF 50% done that is able to flash the keyboard LEDs without toggling the states of the buttons. It will be done by tomorrow Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 10, 2008 Share Posted November 10, 2008 Kind of overkill, but I had to look up how to check the original state of the NUMLOCK before toggling it, and that lead me a useful idea for flashing the LED. Behold, the _SendMorse() UDF:OK, this was neither new, nor original, but it was still an interesting exercise! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 10, 2008 Share Posted November 10, 2008 I have an UDF 50% done that is able to flash the keyboard LEDs without toggling the states of the buttons. It will be done by tomorrow Is it just a DLL call? I was kind of too lazy to look that up and just went with Send("{NUMLOCK ON}") and Send("{NUMLOCK OFF}"). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
monoceres Posted November 10, 2008 Share Posted November 10, 2008 Is it just a DLL call? I was kind of too lazy to look that up and just went with Send("{NUMLOCK ON}") and Send("{NUMLOCK OFF}"). Nope, it involves direct communication with the keyboard device Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
TehWhale Posted November 10, 2008 Share Posted November 10, 2008 I want to be able to turn mine off, but keep the functionality. Like I want Num lock to forever be on, but not show the BRIGHT LED light that shines with it. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 10, 2008 Share Posted November 10, 2008 I want to be able to turn mine off, but keep the functionality. Like I want Num lock to forever be on, but not show the BRIGHT LED light that shines with it.Duct tape.... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TehWhale Posted November 10, 2008 Share Posted November 10, 2008 It shines through the paper and tape I already put on there. Link to comment Share on other sites More sharing options...
Andreik Posted November 10, 2008 Share Posted November 10, 2008 Nope, it involves direct communication with the keyboard device That sounds very interesting. I want to see that. Link to comment Share on other sites More sharing options...
monoceres Posted November 10, 2008 Share Posted November 10, 2008 I want to be able to turn mine off, but keep the functionality. Like I want Num lock to forever be on, but not show the BRIGHT LED light that shines with it.Won't be any problems with my UDF.That sounds very interesting. I want to see that. Patience my young padawan, patience. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Andreik Posted November 11, 2008 Share Posted November 11, 2008 (edited) Won't be any problems with my UDF.Patience my young padawan, patience.For some time trying to find in the dictionary what mean "padawan".Please tell me a synonym. Edited November 11, 2008 by Andreik Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 11, 2008 Share Posted November 11, 2008 For some time trying to find in the dictionary what mean "padawan".Please tell me a synonym. O_O You really don't know? Padawan is the "apprentice" of the Jedi stages. Padawan, Knight, Master. It's a star wars quote/reference. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Andreik Posted November 11, 2008 Share Posted November 11, 2008 O_O You really don't know? Padawan is the "apprentice" of the Jedi stages. Padawan, Knight, Master. It's a star wars quote/reference.I did not know. I searched in the dictionary and find out. I thought to write my english teacher, but in Romania now is time 3 AM. Thank you enlightened me. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now