Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. --------------leD sHOW 2 by veZquEx----------------
  3. | eNjOy a CONtiNUOs LoOP OF InDICaTiNG excIteMEnt.|
  4. |               pResS "EsC" TO PAUse              |
  5. ---------------------------------------------------
  6. */
  7.  
  8.  
  9.  
  10. Continuous:
  11. Loop {
  12.   Loop 6 {
  13. ;walk
  14.     KeyboardLED(2,"on")
  15.     Sleep, 100
  16.     KeyboardLED(2,"off")
  17.     KeyboardLED(4,"on")
  18.     Sleep, 100
  19.     KeyboardLED(4,"off")
  20.     KeyboardLED(1,"on")
  21.     Sleep, 100
  22.     KeyboardLED(1,"off")
  23.     KeyboardLED(4,"on")
  24.     Sleep, 100
  25.     KeyboardLED(4,"off")
  26.   }
  27.   Loop 4 {
  28. ;add
  29.     KeyboardLED(2,"on")
  30.     Sleep, 100
  31.     KeyboardLED(4,"on")
  32.     Sleep, 100
  33.     KeyboardLED(1,"on")
  34.     Sleep, 100
  35.     KeyboardLED(1,"off")
  36.     Sleep, 100
  37.     KeyboardLED(4,"off")
  38.     Sleep, 100
  39.     KeyboardLED(2,"off")
  40.     Sleep, 300
  41.   }
  42.   Loop 8 {
  43. ;flash all
  44.     KeyboardLED(7,"on")
  45.     Sleep, 100
  46.     KeyboardLED(7,"off")
  47.     Sleep, 100
  48.   }
  49.   KeyboardLED(7,"on")
  50.   Sleep, 100
  51.   Loop 3 {
  52.     KeyboardLED(2,"off")
  53.     KeyboardLED(4,"off")
  54.     Sleep, 200
  55.     KeyboardLED(2,"on")
  56.     KeyboardLED(4,"on")
  57.     KeyboardLED(1,"off")
  58.     Sleep, 200
  59.     KeyboardLED(1,"on")
  60.   }
  61.   Loop 3 {
  62.     KeyboardLED(4,"off")
  63.     KeyboardLED(1,"off")
  64.     Sleep, 200
  65.     KeyboardLED(4,"on")
  66.     KeyboardLED(1,"on")
  67.     KeyboardLED(2,"off")
  68.     Sleep, 200
  69.     KeyboardLED(2,"on")
  70.   }
  71.   Loop 3 {
  72.     KeyboardLED(2,"off")
  73.     KeyboardLED(1,"off")
  74.     Sleep, 200
  75.     KeyboardLED(4,"off")
  76.     KeyboardLED(2,"on")
  77.     KeyboardLED(1,"on")
  78.     Sleep, 200
  79.     KeyboardLED(4,"on")
  80.   }
  81.   Sleep, 300
  82.   KeyboardLED(2,"off")
  83.   Sleep, 300
  84.   KeyboardLED(4,"off")
  85.   Sleep, 300
  86.   KeyboardLED(1,"off")
  87.   Sleep, 750
  88. }
  89.  
  90. Escape::
  91. KeyboardLED(2,"on")
  92. KeyboardLED(4,"off")
  93. KeyboardLED(1,"off")
  94. Pause
  95. Return
  96.  
  97. /*
  98.  
  99.     Keyboard LED control for AutoHotkey_L
  100.         http://www.autohotkey.com/forum/viewtopic.php?p=468000#468000
  101.  
  102.     KeyboardLED(LEDvalue, "Cmd", Kbd)
  103.         LEDvalue  - ScrollLock=1, NumLock=2, CapsLock=4
  104.         Cmd       - on/off/switch
  105.         Kbd       - index of keyboard (probably 0 or 2)
  106.  
  107. */
  108.  
  109. KeyboardLED(LEDvalue, Cmd, Kbd=2)
  110. {
  111.   SetUnicodeStr(fn,"\Device\KeyBoardClass" Kbd)
  112.   h_device:=NtCreateFile(fn,0+0x00000100+0x00000080+0x00100000,1,1,0x00000040+0x00000020,0)
  113.  
  114.   If Cmd= switch  ;switches every LED according to LEDvalue
  115.    KeyLED:= LEDvalue
  116.   If Cmd= on  ;forces all choosen LED's to ON (LEDvalue= 0 ->LED's according to keystate)
  117.    KeyLED:= LEDvalue | (GetKeyState("ScrollLock", "T") + 2*GetKeyState("NumLock", "T") + 4*GetKeyState("CapsLock", "T"))
  118.   If Cmd= off  ;forces all choosen LED's to OFF (LEDvalue= 0 ->LED's according to keystate)
  119.     {
  120.     LEDvalue:= LEDvalue ^ 7
  121.     KeyLED:= LEDvalue & (GetKeyState("ScrollLock", "T") + 2*GetKeyState("NumLock", "T") + 4*GetKeyState("CapsLock", "T"))
  122.     }
  123.  
  124.   success := DllCall( "DeviceIoControl"
  125.               ,  "ptr", h_device
  126.               , "uint", CTL_CODE( 0x0000000b     ; FILE_DEVICE_KEYBOARD
  127.                         , 2
  128.                         , 0             ; METHOD_BUFFERED
  129.                         , 0  )          ; FILE_ANY_ACCESS
  130.               , "int*", KeyLED << 16
  131.               , "uint", 4
  132.               ,  "ptr", 0
  133.               , "uint", 0
  134.               ,  "ptr*", output_actual
  135.               ,  "ptr", 0 )
  136.  
  137.   NtCloseFile(h_device)
  138.   return success
  139. }
  140.  
  141. CTL_CODE( p_device_type, p_function, p_method, p_access )
  142. {
  143.   Return, ( p_device_type << 16 ) | ( p_access << 14 ) | ( p_function << 2 ) | p_method
  144. }
  145.  
  146.  
  147. NtCreateFile(ByRef wfilename,desiredaccess,sharemode,createdist,flags,fattribs)
  148. {
  149.   VarSetCapacity(objattrib,6*A_PtrSize,0)
  150.   VarSetCapacity(io,2*A_PtrSize,0)
  151.   VarSetCapacity(pus,2*A_PtrSize)
  152.   DllCall("ntdll\RtlInitUnicodeString","ptr",&pus,"ptr",&wfilename)
  153.   NumPut(6*A_PtrSize,objattrib,0)
  154.   NumPut(&pus,objattrib,2*A_PtrSize)
  155.   status:=DllCall("ntdll\ZwCreateFile","ptr*",fh,"UInt",desiredaccess,"ptr",&objattrib
  156.                   ,"ptr",&io,"ptr",0,"UInt",fattribs,"UInt",sharemode,"UInt",createdist
  157.                   ,"UInt",flags,"ptr",0,"UInt",0, "UInt")
  158.   return % fh
  159. }
  160.  
  161. NtCloseFile(handle)
  162. {
  163.   return DllCall("ntdll\ZwClose","ptr",handle)
  164. }
  165.  
  166.  
  167. SetUnicodeStr(ByRef out, str_)
  168. {
  169.   VarSetCapacity(out,2*StrPut(str_,"utf-16"))
  170.   StrPut(str_,&out,"utf-16")
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement