Advertisement
Emerod

My checkbox script

Dec 5th, 2020
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.54 KB | None | 0 0
  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. Menu, Tray, Icon, C:\Program Files\AutoHotkey\Files\Icon.ico
  6.  
  7.  
  8.  
  9.  
  10. ; ----------------------------------------------------------------- GUI BOX ----------------------------------------------------------------- ;
  11. OnMessage(0x404, "AHK_NOTIFYICON")
  12.  
  13. AHK_NOTIFYICON(wParam, lParam)
  14. {
  15. if (lParam = 0x202) ; WM_LBUTTONUP
  16. Gui, Show, , Hotkeys
  17. else if (lParam = 0x205) ; WM_RBUTTONUP
  18. Menu, Tray, Show
  19. }
  20.  
  21. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptWindowPersistence
  22. Gui, Add, Checkbox, vOptWindowPersistence Checked%1ch%, CTRL + SHIFT + SPACE to keep window ontop
  23. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptCapslockFunctionality
  24. Gui, Add, Checkbox, vOptCapslockFunctionality Checked%1ch%, change capslock to backspace
  25. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptSpecialCharacters
  26. Gui, Add, Checkbox, vOptSpecialCharacters Checked%1ch%, rCTRL for special characters
  27. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptWindowTransparancy
  28. Gui, Add, Checkbox, vOptWindowTransparancy Checked%1ch%, CTRL + SHIFT + SCROLL to change window transparency
  29. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptArrowKeys
  30. Gui, Add, Checkbox, vOptArrowKeys Checked%1ch%, rCTRL and arrowkeys
  31.  
  32. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptKeylogger
  33. Gui, Add, Checkbox, vOptKeyLogger Checked%1ch%, enable KeyLogger
  34.  
  35. IniRead, 1ch, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptMouseTrap
  36. Gui, Add, Checkbox, vOptMouseTrap Checked%1ch%, enable MouseTrap
  37.  
  38.  
  39. Gui, Add, Button, gExitButton, Save and Exit
  40.  
  41. Gui, Submit, Hide
  42.  
  43. ExitButton:
  44. GuiClose:
  45. GuiEscape:
  46. Gui, Submit, Hide
  47. IniWrite, %OptWindowPersistence%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptWindowPersistence
  48. IniWrite, %OptCapslockFunctionality%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptCapslockFunctionality
  49. IniWrite, %OptSpecialCharacters%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptSpecialCharacters
  50. IniWrite, %OptWindowTransparancy%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptWindowTransparancy
  51. IniWrite, %OptArrowKeys%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptArrowKeys
  52.  
  53. IniWrite, %OptKeyLogger%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptKeyLogger
  54. IniWrite, %OptMouseTrap%, C:\Program Files\AutoHotkey\Files\Hotkeys.ini, Checkboxes, checkboxOptMouseTrap
  55. return
  56.  
  57.  
  58. ; ------------------------------------------------------------ WINDOW PERSISTENCE ------------------------------------------------------------ ;
  59. #If OptWindowPersistence
  60. ;toggle selected window always on top with CTRL + SHIFT + SPACE
  61. ^+SPACE:: Winset, Alwaysontop, , A
  62.  
  63.  
  64.  
  65. ; ---------------------------------------------------------- CAPSLOCK FUNCTIONALITY ---------------------------------------------------------- ;
  66. #If OptCapslockFunctionality
  67. ;change capslock funcitonality to backspace
  68. #if !WinActive("ahk_exe javaw.exe") && !WinActive("ahk_exe ")
  69. {
  70. Capslock::Backspace
  71. }
  72. ;CapsLock & Space::Send \^{Backspace} ;doesnt work at all fucks everythign up
  73.  
  74.  
  75.  
  76. ; ------------------------------------------------------------ SPECIAL CHARACTERS ------------------------------------------------------------ ;
  77. #If OptSpecialCharacters
  78. ;rCTRL + [something] to type SPECIAL CHRACTERS
  79. >^`::return
  80. >^1::Send {¹}
  81. !>^1::Send {₁}
  82. +>^1::Send {¡}
  83. >^2::Send {²}
  84. !>^2::Send {₂}
  85. >^3::Send {³}
  86. !>^3::Send {₃}
  87. +>^3::Send {°}
  88. >^4::Send {⁴}
  89. !>^4::Send {₄}
  90. +>^4::Send {€}
  91. !+>^4::Send {ƒ}
  92. >^5::Send {⁵}
  93. !>^5::Send {₅}
  94. +>^5::Send {‰}
  95. >^6::Send {⁶}
  96. !>^6::Send {₆}
  97. +>^6::Send {↑}
  98. !+>^6::Send {↓}
  99. >^7::Send {⁷}
  100. !>^7::Send {₇}
  101. >^8::Send {⁸}
  102. !>^8::Send {₈}
  103. +>^8::Send {×}
  104. !+>^8::Send {•}
  105. >^9::Send {⁹}
  106. !>^9::Send {₉}
  107. >^0::Send {⁰}
  108. !>^0::Send {₀}
  109. >^e::Send {ë}
  110. +>^e::Send {Ë}
  111. !>^e::Send {é}
  112. !+>^e::Send {É}
  113. ~` & e::
  114. if GetKeyState("RCtrl") && !GetKeyState("shift")
  115. send {è}
  116. if GetKeyState("RCtrl") && GetKeyState("shift")
  117. send {È}
  118. return
  119. >^r::Send {®}
  120. >^t::Send {™}
  121. >^u::Send {ü}
  122. +>^u::Send {Ü}
  123. !>^u::Send {ú}
  124. !+>^u::Send {Ú}
  125. ~` & u::
  126. if GetKeyState("RCtrl") && !GetKeyState("shift")
  127. send {ù}
  128. if GetKeyState("RCtrl") && GetKeyState("shift")
  129. send {Ù}
  130. return
  131. >^i::Send {ï}
  132. +>^i::Send {Ï}
  133. !>^i::Send {í}
  134. !+>^i::Send {Í}
  135. ~` & i::
  136. if GetKeyState("RCtrl") && !GetKeyState("shift")
  137. send {ì}
  138. if GetKeyState("RCtrl") && GetKeyState("shift")
  139. send {Ì}
  140. return
  141. >^o::Send {ö}
  142. +>^o::Send {Ö}
  143. !>^o::Send {ó}
  144. !+>^o::Send {Ó}
  145. ~` & o::
  146. if GetKeyState("RCtrl") && !GetKeyState("shift")
  147. send {ò}
  148. if GetKeyState("RCtrl") && GetKeyState("shift")
  149. send {Ò}
  150. return
  151. >^a::Send {ä}
  152. +>^a::Send {Ä}
  153. !>^a::Send {á}
  154. !+>^a::Send {Á}
  155. ~` & a::
  156. if GetKeyState("RCtrl") && !GetKeyState("shift")
  157. send {à}
  158. if GetKeyState("RCtrl") && GetKeyState("shift")
  159. send {À}
  160. return
  161. >^x::Send {✗}
  162. >^c::Send {ç}
  163. +>^c::Send {Ç}
  164. !>^c::Send {©}
  165. >^v::Send {✓}
  166. >^n::Send {ñ}
  167. +>^n::Send {Ñ}
  168. >^=::Send {≈}
  169. !>^=::Send {≠}
  170. +>^=::Send {±}
  171. +>^/::Send {¿}
  172. >^/::Send {÷}
  173. +>^,::Send {←}
  174. +>^.::Send {→}
  175.  
  176.  
  177.  
  178. ; ------------------------------------------------------------ WINDOW TRANSPARENCY ------------------------------------------------------------ ;
  179. #If OptWindowTransparancy && !WinActive("ahk_exe javaw.exe")
  180. ;CTRL + SHIFT + SCROLL
  181. #SingleInstance Force
  182. #MaxThreadsPerHotkey 100
  183.  
  184. SetBatchLines, -1
  185. AutoTrim, Off
  186.  
  187. AlphaIncrement = 8.5
  188.  
  189. Ctrl & MButton::
  190. GetKeyState, ShiftState, Shift
  191. If ShiftState = U
  192. {
  193. Return
  194. }
  195. Gosub, WinGetTransparency
  196. Gosub, WinSetTransparency
  197. Gosub, ShowTransparencyToolTip
  198. Return
  199.  
  200. Ctrl & WheelDown::
  201. GetKeyState, ShiftState, Shift
  202. If ShiftState = U
  203. {
  204. Return
  205. }
  206. Gosub, WinGetTransparency
  207. Trans0 -= 10
  208. Gosub, WinSetTransparency
  209. Gosub, ShowTransparencyToolTip
  210. Return
  211.  
  212. Ctrl & WheelUp::
  213. GetKeyState, ShiftState, Shift
  214. If ShiftState = U
  215. {
  216. Return
  217. }
  218. Gosub, WinGetTransparency
  219. Trans0 += 10
  220. Gosub, WinSetTransparency
  221. Gosub, ShowTransparencyToolTip
  222. Return
  223.  
  224. WinGetTransparency:
  225. MouseGetPos, , , WindowID
  226. If Trans_%WindowID% =
  227. {
  228. Trans_%WindowID% = 100
  229. }
  230. StringTrimRight, Trans, Trans_%WindowID%, 0
  231. Trans0 = %Trans%
  232. Return
  233.  
  234. WinSetTransparency:
  235. WinGetClass, WindowClass, ahk_id %WindowID%
  236. If WindowClass = Progman
  237. {
  238. Trans0 = 100
  239. }
  240. Else If Trans0 < 10
  241. {
  242. Trans0 = 10
  243. }
  244. Else If Trans0 > 100
  245. {
  246. Trans0 = 100
  247. }
  248. a = %Trans%
  249. b = %Trans0%
  250. Trans = %Trans0%
  251. Trans_%WindowID% = %Trans%
  252. If WindowClass = Progman
  253. {
  254. Return
  255. }
  256. a *= 2.55
  257. Alpha0 = %a% ; Starting Alpha
  258. b *= 2.55
  259. Alpha = %b%
  260. Transform, Alpha, Round, %Alpha% ; Ending Alpha
  261. c = %Alpha0% ; Init iteration var.
  262. d = %Alpha%
  263. d -= %Alpha0% ; Range to iterate
  264. Transform, e, Abs, %d%
  265. If e > 0
  266. {
  267. f = %d%
  268. f /= %e% ; Unity increment (+/- 1)
  269. }
  270. Else
  271. {
  272. f = 0
  273. }
  274. g = %f%
  275. g *= %AlphaIncrement% ; Increment
  276. Loop
  277. {
  278. Transform, c, Round, %c%
  279. WinSet, Trans, %c%, ahk_id %WindowID%
  280. If c = %Alpha%
  281. {
  282. Break
  283. }
  284. Else If e >= %AlphaIncrement%
  285. {
  286. c += %g%
  287. e -= %AlphaIncrement%
  288. }
  289. Else
  290. {
  291. c = %Alpha%
  292. }
  293. }
  294. Return
  295.  
  296. ShowTransparencyToolTip:
  297. h = %Trans%
  298. h /= 4
  299. i = 25
  300. i -= %h%
  301. ToolTipText = Opacity :%A_Space%
  302. Loop, %h%
  303. {
  304. ToolTipText = %ToolTipText%|
  305. }
  306. If h > 0
  307. {
  308. ToolTipText = %ToolTipText%%A_Space%
  309. }
  310. ToolTipText = %ToolTipText%%Trans%`%
  311. If i > 0
  312. {
  313. ToolTipText = %ToolTipText%%A_Space%
  314. }
  315. Loop, %i%
  316. {
  317. ToolTipText = %ToolTipText%|
  318. }
  319. ToolTip, %TooltipText%
  320. MouseGetPos, MouseX0, MouseY0
  321. SetTimer, RemoveToolTip
  322. Return
  323.  
  324. RemoveToolTip:
  325. If A_TimeIdle < 1000
  326. {
  327. MouseGetPos, MouseX, MouseY
  328. If MouseX = %MouseX0%
  329. {
  330. If MouseY = %MouseY0%
  331. {
  332. Return
  333. }
  334. }
  335. }
  336. SetTimer, RemoveToolTip, Off
  337. ToolTip
  338. Return
  339.  
  340.  
  341.  
  342. ; ------------------------------------------------------ CHANGE ARROW KEYS FUNCTIONALITY ------------------------------------------------------ ;
  343. #If OptArrowKeys
  344. ; sets right control + arrow key to Page Up/Down, Home/End
  345. >^Down:: Send {PgDn}
  346. >^Up:: Send {PgUp}
  347. >^Left:: Send {Home}
  348. >^Right:: Send {End}
  349.  
  350. ; sets left control + right control to control + PgUp/PgDn/Home/End
  351. <^>^Down:: Send ^{PgDn}
  352. <^>^Up:: Send ^{PgUp}
  353. <^>^Left:: Send ^{Home}
  354. <^>^Right:: Send ^{End}
  355.  
  356. ; sets any Shift + right control to Shift + PgUp/PgDn/Home/End
  357. +>^Down:: Send +{PgDn}
  358. +>^Up:: Send +{PgUp}
  359. +>^Left:: Send +{Home}
  360. +>^Right:: Send +{End}
  361.  
  362. ; sets any alt + right control to move cursor 10 places
  363. !>^Down::Send {Down 10}
  364. !>^Up::Send {Up 10}
  365. !>^Left::Send {Left 10}
  366. !>^Right::Send {Right 10}
  367.  
  368.  
  369.  
  370.  
  371.  
  372. ; ---------------------------------------------------------------- Key Logger ---------------------------------------------------------------- ;
  373.  
  374. #If OptKeyLogger
  375. #noenv
  376. #singleinstance, ignore
  377. setbatchlines, -1
  378. setworkingdir, %a_scriptdir%
  379. process, priority, ,high
  380. coordmode, mouse, screen
  381.  
  382. settimer, mem, 1200000, 0
  383.  
  384. blank=
  385. endkey={enter}{tab}{Backspace}{left}{up}{right}{down}
  386. match=.,?,!
  387.  
  388. while OptKeyLogger
  389. {
  390. msgbox, loop enabled
  391. key=
  392. emptymem()
  393. input, text, imv*, %endkey%, %match%
  394. stringtrimleft, key, errorlevel, 7
  395. stringreplace, key, key, enter, {Enter}
  396. stringreplace, key, key, tab, {Tab}
  397. stringreplace, key, key, backspace, {Backspace}
  398. stringreplace, key, key, left, {Left Arrow}
  399. stringreplace, key, key, up, {Up Arrow}
  400. stringreplace, key, key, right, {Right Arrow}
  401. stringreplace, key, key, down, {Down Arrow}
  402. stringreplace, text, text, , %blank%
  403. time=%a_dd%/%a_mm%/%a_yyyy% %a_hour%:%a_min%:%a_sec%
  404. key=%key%
  405. text=%text%
  406.  
  407. if text=%blank%
  408. {
  409. fileappend, %time% - %key%`n, log.txt
  410. }
  411.  
  412. if key=%blank%
  413. {
  414. fileappend, %time% - %text%`n, log.txt
  415. }
  416.  
  417. if text<>%blank%
  418. {
  419. if key<>%blank%
  420. {
  421. fileappend, %time% - %text%`n, log.txt
  422. fileappend, %time% - %key%`n, log.txt
  423. }
  424. }
  425. }
  426.  
  427. ~esc & f1::return
  428. ~esc up::
  429. {
  430. content = {Esc}
  431. goto, write
  432. }
  433. return
  434.  
  435. ~printscreen & f1::return
  436. ~printscreen up::
  437. {
  438. content = {Print Screen}
  439. goto, write
  440. }
  441. return
  442.  
  443. ~lshift & f1::return
  444. ~lshift up::
  445. {
  446. content = {Left Shift}
  447. goto, write
  448. }
  449. return
  450.  
  451. ~rshift & f1::return
  452. ~rshift up::
  453. {
  454. content = {Right Shift}
  455. goto, write
  456. }
  457. return
  458.  
  459. ~lcontrol & f1::return
  460. ~lcontrol up::
  461. {
  462. content = {Left Ctrl}
  463. goto, write
  464. }
  465. return
  466.  
  467. ~rcontrol & f1::return
  468. ~rcontrol up::
  469. {
  470. content = {Right Ctrl}
  471. goto, write
  472. }
  473. return
  474.  
  475. ~lalt & f1::return
  476. ~lalt up::
  477. {
  478. content = {Left Alt}
  479. goto, write
  480. }
  481. return
  482.  
  483. ~ralt & f1::return
  484. ~ralt up::
  485. {
  486. content = {Right Alt}
  487. goto, write
  488. }
  489. return
  490.  
  491. ~lwin::
  492. {
  493. content = {Left Win}
  494. goto, write
  495. }
  496. return
  497.  
  498. ~rwin::
  499. {
  500. content = {Right Win}
  501. goto, write
  502. }
  503. return
  504.  
  505. ~del & f1::return
  506. ~del up::
  507. {
  508. content = {Delete}
  509. goto, write
  510. }
  511. return
  512.  
  513. ~ins & f1::return
  514. ~ins up::
  515. {
  516. content = {Insert}
  517. goto, write
  518. }
  519. return
  520.  
  521. ~home & f1::return
  522. ~home up::
  523. {
  524. content = {Home}
  525. goto, write
  526. }
  527. return
  528.  
  529. ~end & f1::return
  530. ~end up::
  531. {
  532. content = {End}
  533. goto, write
  534. }
  535. return
  536.  
  537. ~pgup::
  538. {
  539. content = {Page Up}
  540. goto, write
  541. }
  542. return
  543.  
  544. ~pgdn::
  545. {
  546. content = {Page Down}
  547. goto, write
  548. }
  549. return
  550.  
  551. ~^z::
  552. {
  553. content = {Ctrl-Z}
  554. goto, write
  555. }
  556. return
  557.  
  558. ~^x up::
  559. {
  560. content = {Ctrl-X}
  561. goto, write
  562. }
  563. return
  564.  
  565. ~^c up::
  566. {
  567. content = {Ctrl-C}
  568. goto, write
  569. }
  570. return
  571.  
  572. ~^v::
  573. {
  574. content = {Ctrl-V}
  575. goto, write
  576. }
  577. return
  578.  
  579. ~^!del::
  580. {
  581. content = {Ctrl-Alt-Del}
  582. goto, write
  583. }
  584. return
  585.  
  586. ~^+esc::
  587. {
  588. content = {Ctrl-Shift-Esc}
  589. goto, write
  590. }
  591. return
  592.  
  593. ~f1 up::
  594. {
  595. content = {F1}
  596. goto, write
  597. }
  598. return
  599.  
  600. ~f2 up::
  601. {
  602. content = {F2}
  603. goto, write
  604. }
  605. return
  606.  
  607. ~f3 up::
  608. {
  609. content = {F3}
  610. goto, write
  611. }
  612. return
  613.  
  614. ~f4 up::
  615. {
  616. content = {F4}
  617. goto, write
  618. }
  619. return
  620.  
  621. ~f5 up::
  622. {
  623. content = {F5}
  624. goto, write
  625. }
  626. return
  627.  
  628. ~f6 up::
  629. {
  630. content = {F6}
  631. goto, write
  632. }
  633. return
  634.  
  635. ~f7 up::
  636. {
  637. content = {F7}
  638. goto, write
  639. }
  640. return
  641.  
  642. ~f8 up::
  643. {
  644. content = {F8}
  645. goto, write
  646. }
  647. return
  648.  
  649. ~f9 up::
  650. {
  651. content = {F9}
  652. goto, write
  653. }
  654. return
  655.  
  656. ~f10 up::
  657. {
  658. content = {F10}
  659. goto, write
  660. }
  661. return
  662.  
  663. ~f11 up::
  664. {
  665. content = {F11}
  666. goto, write
  667. }
  668. return
  669.  
  670. ~f12 up::
  671. {
  672. content = {F12}
  673. goto, write
  674. }
  675. return
  676.  
  677.  
  678. #If OptMouseTrap
  679. ~lbutton::
  680. {
  681. time=%a_dd%/%a_mm%/%a_yyyy% %a_hour%:%a_min%:%a_sec%
  682. mousegetpos, mx, my
  683.  
  684. if lcount > 0
  685. {
  686. lcount += 1
  687. return
  688. }
  689. else
  690. {
  691. lcount = 1
  692. settimer, go, 300
  693. return
  694. }
  695.  
  696. go:
  697. {
  698. settimer, go, off
  699.  
  700. if lcount = 1
  701. {
  702. content = {Left click - %mx% x %my%}
  703. gosub, write
  704. }
  705. else if lcount > 1
  706. {
  707. content = {Double click - %mx% x %my%}
  708. gosub, write
  709. }
  710. }
  711. lcount = 0
  712. return
  713. }
  714.  
  715. ~rbutton::
  716. {
  717. date=%a_dd%-%a_mm%-%a_yyyy%
  718. time=%a_dd%/%a_mm%/%a_yyyy% %a_hour%:%a_min%:%a_sec%
  719. mousegetpos, mx, my
  720. content = {Right click - %mx% x %my%}
  721. goto, write
  722. }
  723. return
  724.  
  725. ~mbutton::
  726. {
  727. time=%a_dd%/%a_mm%/%a_yyyy% %a_hour%:%a_min%:%a_sec%
  728. mousegetpos, mx, my
  729. content = {Center click - %mx% x %my%}
  730. settimer, write, -120
  731. }
  732. return
  733.  
  734.  
  735. write:
  736. {
  737. time=%a_dd%/%a_mm%/%a_yyyy% %a_hour%:%a_min%:%a_sec%
  738. fileappend, %time% - %content%`n, log.txt
  739. emptymem()
  740. }
  741. return
  742.  
  743. view:
  744. {
  745. fileinstall, log.txt, log.txt, 0
  746. runwait, log.txt
  747. emptymem()
  748. }
  749. return
  750.  
  751. delete:
  752. {
  753. ifexist, log.txt
  754. {
  755. msgbox, 33, Confirm Delete, Delete log?
  756.  
  757. ifmsgbox, ok
  758. {
  759. filerecycle, log.txt
  760. msgbox, 64, Log Deleted, The log file has been sent to the Recycle Bin., 5
  761. emptymem()
  762. return
  763. }
  764. else
  765. {
  766. emptymem()
  767. return
  768. }
  769. }
  770.  
  771. ifnotexist, log.txt
  772. {
  773. msgbox, 64, Cannot Delete Log, Cannot delete log file because it does not exist., 5
  774. emptymem()
  775. return
  776. }
  777. }
  778. return
  779.  
  780. mem:
  781. {
  782. emptymem()
  783. }
  784. return
  785.  
  786. emptymem()
  787. {
  788. return, dllcall("psapi.dll\EmptyWorkingSet", "UInt", -1)
  789. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement