Advertisement
congdantoancau

DELL Laptop Keyboard Hotkey

Dec 8th, 2017
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. ; ==================== MACRO ====================
  7. :*:nl::NULL
  8. return
  9.  
  10. ; WINDOWS KEY + Y TOGGLES FILE EXTENSIONS
  11.  
  12. #y::
  13. RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
  14. If HiddenFiles_Status = 1
  15. RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0
  16. Else
  17. RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
  18. WinGetClass, eh_Class,A
  19. If (eh_Class = “#32770OR A_OSVersion = “WIN_VISTA”)
  20. send, {F5}
  21. Else PostMessage, 0x111, 28931,,, A
  22. Return
  23.  
  24. ; ==================== ALTERNATE UP-ARROW ================       
  25. ; Source: https://autohotkey.com/board/topic/62678-go-up-one-level-in-explorer-xp-ala-windows-7-alt-up/
  26. ; ALT-UP hot key for Explorer in XP to go up one folder level, ala Windows 7
  27. ;#IfWinActive ahk_class CabinetWClass
  28. ;!Up::   Send, {bs} ;Xp already has a shorkcut for this
  29. ;#IfWinActive
  30.  
  31. ; ======================= TASKBAR ======================
  32. #1::
  33. send, #
  34. send, {esc}
  35. send, {tab}
  36. send, {space}
  37. return
  38.  
  39.  
  40. ; =========================== CHROME =======================
  41. ;#ifwinactive ahk_class chrome_widgetwin_1 (This does not work on XP)
  42. ;#ifwinactive
  43.  
  44. +bs::
  45. SetTitleMatchMode, 2
  46. if Winactive("Chrome")
  47.     send, ^w
  48. return
  49.  
  50.    
  51.  
  52. ; ======================= DESKTOP PROGRAM FOLDER ========================
  53. #IfWinActive, Prgrms ahk_exe explorer.exe
  54. $LButton::
  55. WinGet, ID, ID, A
  56. Click, 2
  57. WinClose, ahk_id %ID%
  58. return
  59. #IfWinActive
  60.  
  61. ; ======================= FOLDER ACTION ========================
  62. ; #IfWinActive ahk_class CabinetWClass (this not work on XP)
  63. #IfWinActive, ahk_class ExploreWClass
  64. ]::
  65. send, !{space}
  66. send, x
  67. return
  68. [::
  69. send, !{space}
  70. send r
  71. return
  72. !up::
  73. send,!v
  74. send, o
  75. send, u
  76. return
  77. #IfWinActive
  78.  
  79. ; ================================== HIDE TASKBAR =====================================
  80. ; https://autohotkey.com/board/topic/83594-how-to-hide-taskbar-with-hotkey/
  81. #SingleInstance Force
  82.  
  83. !t:: ; Alt+T Hotkey
  84. WinExist("ahk_class Shell_TrayWnd")
  85. ControlGetPos,,,, hTB, ahk_class Shell_TrayWnd  ; Get Taskbar Height
  86. t := !t  ; Toggle Var (0 or 1)
  87.  
  88. VarSetCapacity(area, 16)
  89. WinGetActiveStats, AT, AW, AH, AX, AY  ; Get Active Window Stats
  90.  
  91. If (t = "1") {  ; Hide
  92.     Top := A_ScreenHeight
  93.     WinHide, ahk_class Shell_TrayWnd  ; Hide Taskbar
  94.     WinHide, Start ahk_class Button  ; Hide Start Button
  95.     WinMove, %AT%,,,0,, %A_ScreenHeight%  ; Increase Active Window's Height
  96. } Else {  ; Show
  97.     Top := A_ScreenHeight - hTB  ; Screen Height - Taskbar Height
  98.     WinShow, ahk_class Shell_TrayWnd  ; Show Taskbar
  99.     WinShow, Start ahk_class Button  ; Show Start Button
  100.     WinMove, %AT%,,,0,, (A_ScreenHeight-hTB)  ; Decrease Active Window's Height
  101. }
  102.  
  103. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 0, UInt,4, UInt,0)
  104. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 4, UInt,4, UInt,0)
  105. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 8, UInt,4, UInt,A_ScreenWidth)
  106. DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 12,UInt,4, UInt,Top)
  107. DllCall("SystemParametersInfo", UInt,0x2F, UInt,0, UInt,&area, UInt,0)
  108. return
  109.  
  110. ; Hide task: http://hackerspace.kinja.com/another-late-ahk-script-that-hides-the-taskbar-1701996722
  111.  
  112. ; ============================ HIDE DESKTOP ICON =================================
  113. #h::
  114. MouseGetPos,,,win
  115. WinGetClass, class, ahk_id %win%
  116. If class in Progman,WorkerW
  117.  {
  118.     ControlGet, HWND, Hwnd,, SysListView321, ahk_class Progman
  119.     If HWND =
  120.         ControlGet, HWND, Hwnd,, SysListView321, ahk_class WorkerW
  121.     If DllCall("IsWindowVisible", UInt, HWND)
  122.         WinHide, ahk_id %HWND%
  123.     Else
  124.         WinShow, ahk_id %HWND%
  125.  
  126.     Return
  127. }
  128. else
  129. {
  130. ; WINDOWS KEY + H TOGGLES HIDDEN FILES
  131.     RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
  132. If HiddenFiles_Status = 2  
  133.     RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
  134. Else  
  135.     RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
  136.     WinGetClass, eh_Class,A
  137. If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
  138.     send, {F5}
  139. Else
  140.     PostMessage, 0x111, 28931,,, A
  141. Return
  142. }
  143. Return
  144. ;https://autohotkey.com/board/topic/40217-how-to-check-if-desktop-is-active/
  145. ;https://autohotkey.com/board/topic/46689-my-first-script-for-hidding-desktop-icons/
  146.  
  147. ; Double click
  148. ~LButton::
  149.  If ( A_PriorHotKey = A_ThisHotKey && A_TimeSincePriorHotkey < 400 ) {
  150.    WinGetClass, Class, A
  151.    If Class in Progman,WorkerW
  152.    var := (flag=0) ? "Show" : "Hide"
  153.    flag := !flag
  154.    Control,%var%,, SysListView321, ahk_class Progman
  155.    Control,%var%,, SysListView321, ahk_class WorkerW
  156. }
  157. Return
  158.  
  159. ;https://autohotkey.com/board/topic/38006-double-click-desktop-to-hide-icons/
  160. ;https://autohotkey.com/board/topic/38071-toggle-visibility-of-desktop-icons-by-doubleclicking-desktop/
  161.  
  162. ; =================== CREATE TXT ==========================
  163.  
  164. #IfWinActive, ahk_class ExploreWClass
  165.  
  166. ^+t::
  167. send !f
  168. loop ;wait until on new menu item
  169. {
  170.     StatusBarGetText, status
  171.     IfInString, status, new
  172.     {
  173.         break
  174.     }
  175.     send {down}
  176. }
  177. send {right}
  178. send t
  179. return
  180.  
  181. ; =================== CREATE FOLDER ==========================
  182. ; https://lifehacker.com/5072853/create-new-folders-in-explorer-with-a-shortcut
  183. ; New folder script -- Creates new folder
  184. ; in Windows Explorer with Ctrl-N
  185. ; https://superuser.com/questions/403337/autohotkey-script-not-recognizing-windows-explorer
  186.  
  187.  
  188. #IfWinActive ahk_class ExploreWClass
  189.     ^+n::
  190. #IfWinActive ahk_class CabinetWClass
  191.     ^+n::
  192.         send !f
  193.     loop ;wait until on new menu item
  194.     {
  195.         StatusBarGetText, status
  196.         IfInString, status, new
  197.         {
  198.             break
  199.         }
  200.         send {down}
  201.     }
  202.     send {right}{enter}
  203.     return
  204. #IfWinActive
  205.  
  206.  
  207.  
  208. ; ================== CLOSE ALL WINDOWS ====================
  209. #F4::
  210. WinGet, id, list, , , Program Manager
  211. Loop, %id%
  212. {
  213.     StringTrimRight, this_id, id%a_index%, 0
  214.     WinGetTitle, this_title, ahk_id %this_id%
  215.     winclose,%this_title%
  216. }
  217. Return
  218.  
  219. ;=========== VIEW MODE =============
  220. ; #IfWinActive ahk_class CabinetWClass (This not work on XP)
  221. #IfWinActive, ahk_class ExploreWClass
  222. ; alt+3 large icons
  223. ; alt+7 detail
  224. !2::Send !v{down 2}{enter}
  225. !3::Send !v{down 3}{enter}
  226. !4::send !v{down 4}{enter}
  227. !6::Send !v{down 6}{enter}
  228. !7::Send !v{down 7}{enter}
  229. !8::send !v{down 8}{enter}
  230. #IfWinActive
  231.  
  232. ; ============= Ctrl Backspace ==============
  233. ; how to write scripts: http://www.autohotkey.com/docs/
  234. #IfWinActive ahk_class CabinetWClass ; File Explorer
  235.     ^Bs::
  236. #IfWinActive, ahk_class Notepad
  237.     ^Bs::
  238.     Send ^+{Left}{Backspace}
  239.     return
  240. #IfWinActive
  241.  
  242. ; source and context: http://superuser.com/a/636973/124606
  243.  
  244. ; relevant documentation links:
  245. ; writing hotkeys
  246. ; http://www.autohotkey.com/docs/Hotkeys.htm
  247. ; list of key codes (including Backspace)
  248. ; http://www.autohotkey.com/docs/KeyList.htm
  249. ; the #IfWinActive directive
  250. ; http://www.autohotkey.com/docs/commands/_IfWinActive.htm
  251. ; the Send command
  252. ; http://www.autohotkey.com/docs/commands/Send.htm
  253.  
  254. ;__________________________________________________
  255.  
  256.  
  257. ; ============= WINDOWS EXIT =============
  258. ~esc::
  259. if (A_PriorHotkey <> "~esc" or A_TimeSincePriorHotkey > 400)
  260. {
  261.     ; Too much time between presses, so this isn't a double-press.
  262.     KeyWait, esc
  263.     return
  264. }
  265. send !{f4} ;winclose, a
  266. return
  267.  
  268. ; #IfWinActive ahk_class CabinetWClass (This does not work on XP)
  269. #IfWinActive, ahk_class ExploreWClass
  270. ~end::
  271. if (A_PriorHotkey <> "~end" or A_TimeSincePriorHotkey > 400)
  272. {
  273.     KeyWait, end
  274.     return
  275. }
  276. send, ^w
  277. return
  278. #ifWinActive
  279.  
  280. ~end::
  281. if (A_PriorHotkey <> "~end" or A_TimeSincePriorHotkey > 400)
  282. {
  283.     KeyWait, end
  284.     return
  285. }
  286. send, ^{f4}
  287. return
  288.  
  289. ; ============= SAVE ==============
  290.  
  291. ; #IfWinActive ahk_class ChromeWindowsClass (This does not work on XP)
  292. Appskey::
  293. SetTitleMatchMode, 2
  294. if WinActive("Chrome")
  295. {
  296.     send, ^s
  297.     Sleep, 100
  298.     send, {esc}
  299. }
  300. return
  301.  
  302.  
  303. +Appskey::AppsKey
  304. return
  305.  
  306. ; ============= RUN MENU ===============
  307. ;~lwin::
  308. if (A_PriorHotkey <> "~lwin" or A_TimeSincePriorHotkey > 400)
  309. {
  310.     KeyWait, lwin
  311.     return
  312. }
  313. run "C:\Documents and Settings\UserS2s.USERS2\Desktop"
  314. return
  315.  
  316.  
  317. ; ============= NAVIGATION ==============
  318. Insert::^a
  319. return
  320. ;Pause::^p
  321.  
  322. $numlock::scrolllock
  323. return
  324. ~+numlock::send {numlock}
  325. return
  326.  
  327. #appskey:: run "C:\Documents and Settings\UserS2s.USERS2\Desktop\Prgms"
  328. return
  329.  
  330. #IfWinactive ahk_class CabinetWClass
  331. #n::
  332. Send ^e{Tab}
  333. Send {Down}ln
  334. return
  335. #IfWinactive,
  336.  
  337.  
  338. ; ============ SCROLL LOCK ===========
  339. #If GetKeyState("Scrolllock","T") ; Hotkeys below this can only be activated if ScrollLock is On
  340. pgup::wheelup
  341. return
  342. pgdn::wheeldown
  343. return
  344. #if ; this resets the condition so that all hotkeys below this directive can be activated
  345.  
  346.  
  347. ; ============= FUNCTIONS ==================
  348. ~F4::^v
  349. return
  350. ^F4::F4
  351. return
  352. ~F7::^+Tab
  353. return
  354. ~F8::^Tab
  355. return
  356. ~F9:: browser_home
  357. return
  358. ~F10:: browser_stop
  359. return
  360.  
  361. ; ---------- F3 Function -------------
  362. $F3::
  363. KeyWait, F3 ; wait for F3 released
  364. KeyWait, F3, D T0.2 ; wait 1 second for F3 pressed again
  365. If ErrorLevel ; if 1 second passes before F3 is pressed again
  366. {
  367.     Send ^c ; or whatever your copy code is
  368. }
  369. else ; we will now allow F3 to be pressed normally
  370. {
  371.     Loop
  372.     {
  373.         Send {F3 down}
  374.         KeyWait, F3 ; wait for F3 release
  375.         Send {F3 up}
  376.         KeyWait, F3, D T1 ; wait 1 second for F3 pressed again
  377.         If ErrorLevel ; if 1 second passes before F3 is pressed again
  378.            Break ; exit his Loop
  379.     }
  380. }
  381. return
  382.  
  383.  
  384. ; ------------ F2 function -------------
  385. ~Shift::
  386. if (A_PriorHotkey <> "~Shift" or A_TimeSincePriorHotkey > 400)
  387. {
  388.     ; Too much time between presses, so this isn't a double-press.
  389.     KeyWait, Shift
  390.     return
  391. }
  392. send {F2}
  393. return
  394.  
  395.  
  396. ; =========== POWER ===============
  397. ^!F5:: ;turn off monitor
  398. Sleep, 200
  399. SendMessage,0x112,0xF170,2,,Program Manager
  400. return
  401. #pause:: ;sleep
  402. DllCall("PowrProf\SetSuspendState", "int", 0, "int", 1, "int", 0)
  403. return
  404. !+F5:: ;hibernate
  405. DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
  406. return
  407. #end:: ;shutdown
  408. shutdown, 1
  409. return
  410.  
  411.  
  412. ;============ RUN PROGRAMES ==============
  413. !+d::run idm514
  414. return
  415. !+g:: run chrome
  416. return
  417. !+h::run QQPYHandInput
  418. return
  419. !+l::run lingoes
  420. return
  421. ^!n::run notepad
  422. return
  423. !+n:: run networks
  424. return
  425.  
  426.  
  427.  
  428. ; ========== Local Hotkeys =============
  429. ^!s::
  430. suspend
  431. if (A_IsSuspended)
  432. {
  433.   tooltip, Prius disabled
  434.   Sleep, 1500
  435.   tooltip
  436. }
  437. else
  438. {
  439.   tooltip, Prius enabled
  440.   Sleep, 1500
  441.   tooltip
  442. }
  443. return
  444.  
  445. ^!p::pause
  446. return
  447.  
  448. ^!r::Reload  ; Assign Ctrl-Alt-R as a hotkey to restart the script.
  449. return
  450.  
  451. ^!e::edit
  452. return
  453.  
  454. ; ============= WINHOTKEYS ==================
  455. #c::run calc
  456. return
  457. #+d::run shell:desktop
  458. return
  459. #i::run iexplore
  460. return
  461. #j::run D:\Documents\Downloads
  462. return
  463. #o::run D:\Documents\Visual Studio 2008\Projects
  464. return
  465. #s:: run devenv
  466. return
  467. #w::run winword
  468. return
  469. #v::run sndvol
  470. return
  471. #x::run excel
  472. return
  473. #+n::run notepad++
  474. return
  475. #delete::FileRecycleEmpty
  476. return
  477.  
  478. ;============== VOLUME ==================
  479. !wheelup::
  480. send {volume_up 10}
  481. return
  482. !wheeldown::
  483. send {volume_down 10}
  484. return
  485. !numpaddiv::
  486. soundset +10
  487. return
  488. !numpadmult::
  489. soundset -10
  490. return
  491.  
  492. ; ============ MOUSE WHELL VOLUME ===================
  493. ~WheelUp::mouseWheelVolume("+10")
  494. ~WheelDown::mouseWheelVolume("-10")
  495. mouseWheelVolume(step)
  496. {  mouseGetPos,mx,my,wnd
  497.    wingetClass,cls,ahk_id %wnd%
  498.    if cls=Shell_TrayWnd
  499.    {  SoundSet %step%
  500.       soundSet 0,,mute
  501.       soundGet vol
  502.       ifInString,vol,.
  503.          stringMid,vol,vol,1,% inStr(vol,".")-1
  504.       tooltip, Volume:%vol%`%,% mx+8,% my+8,19
  505.       setTimer removeVolumeTip,2000
  506.    }
  507.    return
  508. removeVolumeTip:
  509.   tooltip,,,,19
  510.    settimer removeVolumeTip,OFF
  511.    return
  512. }
  513.  
  514.  
  515. ; ============= MEDIA ==================
  516. !pgdn::
  517. send, {media_next}
  518. return
  519. !pgup::
  520. send, {media_prev}
  521. return
  522. numpad0::media_play_pause
  523. return
  524. numpaddot::
  525. send {media_stop}
  526. return
  527.  
  528. ~pause::media_play_pause
  529. return
  530. +pause::media_stop
  531. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement