Isoraqathedh

_Main.ahk

Jun 22nd, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. #SingleInstance force
  3. #Persistent
  4. #LTrim
  5. SetTitleMatchMode 2
  6. SendMode input
  7. SetWorkingDir %A_ScriptDir%
  8. DetectHiddenWindows on
  9. IfWinNotExist ahk_exe Columbus.exe
  10.     Run Columbus.exe
  11. ;{ Global Variables
  12. IniRead iter, _Main.ini, Main, iter, 0
  13. IniRead weatherSettings, _Main.ini, Main, weather, hko
  14. superMode = none
  15. ;{ Dead Key List
  16. deadKeyList := {}
  17. deadKeyList["Grave"]:=     {"a":"à", "e":"è", "i":"ì", "n":"ǹ", "o":"ò", "u":"ù", "w":"ẁ", "y":"ỳ"
  18.     ,                                "none":"``"}
  19. deadKeyList["Tilde"]:=     {"a":"ã", "e":"ẽ", "i":"ĩ", "n":"ñ", "o":"õ", "u":"ũ", "v":"ṽ", "y":"ỹ"
  20.     ,                                "none":"~"}
  21. deadKeyList["Acute"]:=     {"a":"á", "c":"ć", "e":"é", "g":"ǵ", "i":"í", "k":"ḱ", "l":"ĺ", "m":"ḿ"
  22.     ,                                "n":"ń", "o":"ó", "p":"ṕ", "r":"ŕ", "s":"ś", "u":"ú", "w":"ẃ"
  23.     ,                                "y":"ý", "z":"ź", "æ":"ǽ", "none":"'"}
  24. deadKeyList["Umlaut"]:=    {"a":"ä", "e":"ë", "h":"ḧ", "i":"ï", "o":"ö", "t":"ẗ", "u":"ü", "w":"ẅ"
  25.     ,                                "x":"ẍ", "y":"ÿ", "none":Chr(34)}
  26. deadKeyList["Circumflex"]:={"a":"â", "c":"ĉ", "e":"ê", "g":"ĝ", "h":"ĥ", "i":"î", "j":"ĵ", "o":"ô"
  27.     ,                                "s":"ŝ", "u":"û", "w":"ŵ", "y":"ŷ", "z":"ẑ",  "none":"+6"}
  28. deadKeyList["Macron"]:=    {"a":"ā", "b":"ḇ", "d":"ḏ", "e":"ē", "g":"ḡ", "h":"ẖ", "i":"ī", "k":"ḵ"
  29.     ,                                "l":"ḻ", "n":"ṉ", "o":"ō", "r":"ṟ", "t":"ṯ", "u":"ū", "y":"ȳ"
  30.     ,                                "z":"ẕ", "none":"-"}
  31. deadKeyList["Stroke"]:=    {"a":"ⱥ", "b":"ƀ", "c":"ȼ", "d":"đ", "e":"ɇ", "g":"ǥ", "h":"ħ", "i":"ɨ"
  32.     ,                                "j":"ɉ", "l":"ł", "o":"ø", "p":"ᵽ", "r":"ɍ", "t":"ŧ", "u":"ʉ"
  33.     ,                                "y":"ɏ", "z":"ƶ", "none":"_"}
  34. deadKeyList["Ring"]:=      {"a":"å", "u":"ů", "w":"ẘ", "y":"ẙ", "none":"˚"}
  35. deadKeyList["Caron"]:=     {"a":"ǎ", "c":"č", "d":"ď", "e":"ě", "g":"ǧ", "h":"ȟ", "i":"ǐ", "j":"ǰ"
  36.     ,                                "k":"ǩ", "l":"ľ", "n":"ň", "o":"ǒ", "r":"ř", "s":"š", "t":"ť"
  37.     ,                                "u":"ǔ", "z":"ž", "none":"ˇ"}
  38. deadKeyList["Cedilla"]:=   {"c":"ç", "d":"ḑ", "e":"ȩ", "g":"ģ", "h":"ḩ", "k":"ķ", "l":"ļ", "n":"ņ"
  39.     ,                                "r":"ŗ", "s":"ş", "t":"ţ", "none":"¸"}
  40. deadKeyList["Ogonek"]:=    {"a":"ą", "e":"ę", "i":"į", "o":"ǫ", "u":"ų", "none":"˛"}
  41. deadKeyList["Breve"]:=     {"a":"ă", "e":"ĕ", "g":"ğ", "h":"ḫ", "i":"ĭ", "o":"ŏ", "u":"ŭ"
  42.     ,                                "none":"˘"}
  43. deadKeyList["Dot"] :=      {"a":"ȧ", "b":"ḃ", "c":"ċ", "d":"ḋ", "e":"ė", "f":"ḟ", "g":"ġ", "h":"ḣ"
  44.     ,                                "i":"ı", "j":"ȷ", "l":"ŀ", "m":"ṁ", "n":"ṅ", "o":"ȯ", "s":"ṡ"
  45.     ,                                "t":"ṫ", "w":"ẇ", "x":"ẋ", "y":"ẏ", "z":"ż", "none":"·"}
  46.    
  47. diacriticsList := []
  48. for k, v in deadKeyList
  49.     diacriticsList.Insert(k)
  50. allPages := Ceil(diacriticsList.MaxIndex() / 4)
  51. diacriticsPointer = 1
  52. selectedDiacritics := {w: "", a: "", s: "", d:""}
  53. DiacriticsOffset := {w: 1, a: 2, s: 3, d: 4}
  54. ;} Dead Key List
  55. fractions := {12:"½", 13:"⅓", 23:"⅔", 14:"¼", 24:"½", 34:"¾", 15:"⅕", 25:"⅖", 35:"⅗", 45:"⅘"
  56.     , 16:"⅙", 26:"⅓", 36:"½", 46:"⅔", 56:"⅚", 18:"⅛", 28:"¼", 38:"⅜", 48:"½", 58:"⅝", 68:"¾", 78:"⅞"}
  57. ;}
  58. ;{ Cleanup script
  59. cleanUp() {
  60.     /*
  61.     RunWait counter.bat, Z:\, hide
  62.     fileCount = 0
  63.     Loop, read, rename.txt
  64.         fileCount += %A_LoopReadLine%
  65.     */
  66.     ;MsgBox %fileCount%
  67.     If fileCount <> 0
  68.         RunWait rename.ahk
  69.     RunWait % (FileExist( "\\psf\Home\Pictures\Scan Inputs\*.j*" ) && !WinExist( "scan.ahk" ))
  70.         ? "scan2.ahk"
  71.         : ""
  72.     /*
  73.     IfExist \\psf\Home\Pictures\Scan Inputs\*.j*
  74.         IfWinNotExist scan.ahk
  75.             RunWait, scan2.ahk
  76.     */
  77. }
  78.  
  79. light(lightNumber, toggle) {
  80.     DetectHiddenWindows on
  81.     if WinExist("arduino-control.ahk ahk_class AutoHotkey")
  82.         PostMessage 4101, %lightNumber%, %toggle%
  83.     DetectHiddenWindows off
  84. }
  85.  
  86. addOnTime(toAdd) {
  87.     nowTime := A_Now
  88.     nowTime += %toAdd%, minutes
  89.     FormatTime keyMinutes, %nowTime%, HH:mm:ss
  90.     Return keyMinutes
  91. }
  92.  
  93. SetTimer, CleanupAll, % 60 * 60 * 1000
  94. ;SetTimer, ClearMods, % 1000
  95.  
  96.  
  97.  
  98. CleanupAll:
  99.     ;light(5, 1)
  100.     iter += 1
  101.     scheduled := addOnTime(60) . ", " . addOnTime(120) . " and " . addOnTime(180)
  102.     cleanUp()
  103.     IniRead, countScreen, dat\rename.ini, main, screenshots, 0
  104.     IniRead, countDl, dat\rename.ini, main, downloads, 0
  105.     IniRead, currDate, dat\rename.ini, main, date, 0
  106.     FileRead, results, completed.txt
  107.     SetFormat, IntegerFast, D
  108.     SetFormat, Integer, D
  109.     iter := iter + 0
  110.     TrayTip Cleanup Process Completed,
  111.     (
  112.     Organized Downloads/Screenshots, iteration %iter%
  113.     Next scheduled times are:
  114.     %scheduled%.
  115.     %countScreen% file(s) moved to screenshots\%currDate%\
  116.     %countDl% file(s) moved to downloads\%currDate%\
  117.     ), 10, 1
  118.     ;light(5, 0)
  119.     if WinExist("arduino-control.ahk ahk_class AutoHotkey")
  120.         PostMessage 4110, %lightNumber%, %toggle%
  121. Return
  122.  
  123. CloseToolTip:
  124.     ToolTip
  125. Return
  126. ;} cleanup script
  127.  
  128. #Include USIntExt4Ext1.ahk
  129. #include %A_ScriptDir%\lib\Arduino.ahk
  130.  
  131. DeadKey(diacritic) {
  132.     global deadKeyList
  133.     light(1, 1)
  134.     Suspend On
  135.     ToolTip Type the letter that the %diacritic% needs to be put on.
  136.     Input letter, l1
  137.     ToolTip
  138.     Suspend Off
  139.     if (letter = " ")
  140.         Send % deadKeyList[diacritic, "none"]
  141.     else if (deadKeyList[diacritic].hasKey(letter))
  142.     {
  143.         outLetter := deadKeyList[diacritic, letter]
  144.         if letter is upper
  145.             StringUpper, outLetter, outLetter
  146.         Send %outLetter%
  147.     }
  148.     else, Send % deadKeyList[diacritic, "none"] . letter
  149.     light(1, 0)
  150. }
  151.  
  152. ;{ Basic keys
  153. >!Left::SendInput
  154. >!Up::SendInput
  155. >!Right::SendInput
  156. >!Down::SendInput
  157. ;NumpadHome::SendInput ↖
  158. ;NumpadEnd::SendInput ↙
  159. ;NumpadPgUp::SendInput ↗
  160. ;NumpadPgDn::SendInput ↘
  161. ;NumpadClear::Return
  162. #d::Return ;Noops this so it won't show the desktop.
  163. ;{ Basic Dead Keys
  164. $`::DeadKey("Grave")
  165. $+`::DeadKey("Tilde")
  166. $'::DeadKey("Acute")
  167. $+'::DeadKey("Umlaut")
  168. $+6::DeadKey("Circumflex")
  169. $-::DeadKey("Macron")
  170. $+-::DeadKey("Stroke")
  171. <^>!+`::DeadKey("Ring")
  172. <^>!v::DeadKey("Caron")
  173. <^>!.::DeadKey("Cedilla")
  174. <^>!`::DeadKey("Breve")
  175. <^>!+.::DeadKey("Ogonek")
  176. $NumpadSub::Send {blind}-
  177. >!\::
  178.     thisPage = -1
  179.     loop
  180.     {
  181.         thisPage := Mod(thisPage + (keyPressed = "q" ? allPages - 1 : 1), allPages)
  182.         keyLabels := "w: " . (diacriticsList[thisPage * 4 + 1] = "" ? "-" : diacriticsList[thisPage * 4 + 1])
  183.             .      "`na: " . (diacriticsList[thisPage * 4 + 2] = "" ? "-" : diacriticsList[thisPage * 4 + 2])
  184.             .      "`ns: " . (diacriticsList[thisPage * 4 + 3] = "" ? "-" : diacriticsList[thisPage * 4 + 3])
  185.             .      "`nd: " . (diacriticsList[thisPage * 4 + 4] = "" ? "-" : diacriticsList[thisPage * 4 + 4])
  186.         nil := thisPage + 1
  187.         IfWinNotExist AHK Dead Keys
  188.             SplashTextOn, 300, 200, AHK Dead Keys (Page %nil% of %allPages%), %keyLabels% `n`ne: next page`nq: last page`nx: quit`n
  189.         else {
  190.             WinSetTitle,,, AHK Dead Keys (Page %nil% of %allPages%)
  191.             ControlSetText, Static1, %keyLabels% `n`ne: next page`nq: last page`nx: quit`n
  192.         }
  193.         Input nil, , wasdeqx
  194.         nil = ; we can discard the rest
  195.         StringRight keyPressed, ErrorLevel, 1
  196.     } until not (keyPressed = "e" or keyPressed = "q")
  197.     SplashTextOff
  198.     if (keyPressed = "x" or diacriticsList[thisPage * 4 + DiacriticsOffset[keyPressed]] = "")
  199.         return
  200.     else
  201.         DeadKey(diacriticsList[thisPage * 4 + DiacriticsOffset[keyPressed]])
  202. return
  203.  
  204. DisplayPage:
  205. Return
  206. ;} Basic Dead Keys
  207. ;{ AltGr
  208. ;{ lc
  209. >!q::Send œ
  210. >!r::Send ®
  211. >!t::Send þ
  212. >!a::Send æ
  213. >!s::Send ß
  214. >!d::Send ð
  215. >!f::Send г
  216. >!g::Send ȝ
  217. >!h::Send ħ
  218. >!j::Send ж
  219. >!k::Send ф
  220. >!o::Send ø
  221. >!z::Send ʒ
  222. >!c::Send ©
  223. >!b::Send ρ
  224. >!n::Send ñ
  225. >!m::Send µ
  226. >![::Send «
  227. >!]::Send »
  228. ; >!\::Send ¬
  229. >!;::Send ¶
  230. >!,::Send ç
  231. >!/::Send
  232. ;} lc
  233. ;{ digits
  234. >!1::Send ¡
  235. >!2::Send ²
  236. >!3::Send ³
  237. >!4::Send ¤
  238. >!5::Send
  239. >!6::Send ¼
  240. >!7::Send ½
  241. >!8::Send ¾
  242. >!9::Send
  243. >!0::Send
  244. >!-::Send ¥
  245. >!=::Send ×
  246. >!+1::Send ¹
  247. >!+4::Send £
  248. >!+=::Send ÷
  249. >!+/::Send
  250. ;} digits
  251. ;{ uc
  252. >!+q::Send Œ
  253. >!+t::Send Þ
  254. >!+a::Send Æ
  255. >!+s::Send §
  256. >!+d::Send Ð
  257. >!+f::Send Г
  258. >!+g::Send Ȝ
  259. >!+h::Send Ħ
  260. >!+j::Send Ж
  261. >!+k::Send Ф
  262. >!+o::Send Ø
  263. >!+z::Send Ʒ
  264. >!+c::Send ¢
  265. >!+v::Send ·
  266. >!+b::Send Ρ
  267. >!+n::Send Ñ
  268. >!+[::Send
  269. >!+]::Send
  270. >!+;::Send °
  271. >!+,::Send Ç
  272. ;} uc
  273. ;} AltGr
  274. ;} Basic Keys
  275.  
  276. ;{ Special keys
  277. ;{ M1 – Keyboard
  278. NumpadClear & NumpadEnd:: ;M1G1
  279. MsgBox Cleaning up...
  280. CleanUp()
  281. Return
  282.  
  283. NumpadClear & NumpadDown:: ;M1G2
  284.     SetTimer ChangeButtonNames, 50
  285.     MsgBox, 4, _Main.ahk time output, Do you want simple or verbose time output?
  286.     IfMsgBox, No
  287.         FormatTime currTime,, H 'hours,' m 'minutes and' s 'seconds have passed since day number' d 'of' MMMM 'in the year of our lord' yyyy
  288.     else, FormatTime currTime,, HH:mm:ss dd.MM.yyyy
  289.     SendInput %currTime%
  290. Return
  291.  
  292. ChangeButtonNames:
  293.     IfWinNotExist, _Main.ahk time output
  294.         return  ; Keep waiting.
  295.     SetTimer, ChangeButtonNames, off
  296.     WinActivate
  297.     ControlSetText, Button1, &Simple
  298.     ControlSetText, Button2, &Verbose
  299. return
  300.  
  301. WheelLeft:: ;M1G3
  302.     IniWrite, %iter%, _Main.ini, Main, iter
  303.     doNotKeepNumber = 1
  304.     +WheelLeft:: ;+M1G3 – reload while not keeping iteration number
  305.     if doNotKeepNumber <> 1
  306.         IniWrite, 0, _Main.ini, Main, iter
  307.     SoundPlay C:\Windows\Media\chimes.wav, wait
  308.     Reload
  309. Return
  310.  
  311. NumpadClear & NumpadPgDn::Run Scan2.ahk ;M1G4
  312.  
  313. +WheelRight:: ;+M1G5 - weather settings
  314.     InputBox weatherSettings, Weather Settings,
  315.     (
  316.     Select the settings to apply to the weather detector:
  317.     One of: fio for FORECAST.IO, or hko for HKO; then
  318.     One of: nothing for simple units, or -n for True Blue SI Units; then
  319.     One of: nothing for cached data, or -c for current data
  320.     ),,,,,,,,%weatherSettings%
  321.     if errorLevel
  322.         return
  323. WheelRight:: ;M1G5 – weather
  324.     RunWait C:\Windows\py.exe weather.py %weatherSettings%, Z:\Documents\AutoHotkey
  325.     IniRead result, _Main.ini, weather, message
  326.     IniRead isOld, _Main.ini, weather, olddata
  327.     if isOld = True
  328.         result = %result% (Cached data)
  329.     MsgBox, 4, , %result%. Type result?
  330.     IfMsgBox No
  331.         return
  332.     else, Send %result%
  333. Return
  334.  
  335. NumpadClear & NumpadLeft:: ;M1G6
  336.     InputBox requestedLocation, Write a location,Please write a location for which you want to find the timezone.
  337.     if errorLevel
  338.     {
  339.         MsgBox Action cancelled.
  340.         Return
  341.     }
  342.     If InStr(requestedLocation, A_Space)
  343.         requestedLocation := Chr(34) . requestedLocation . Chr(34)
  344.     RunWait C:\Windows\py.exe timezones.py %requestedLocation%
  345.     IniRead result, _Main.ini, local time, message
  346.     IniRead errors, _Main.ini, local time, error
  347.     if errors <> none
  348.         MsgBox There had been an error: %errors%
  349.     Else
  350.     {
  351.         MsgBox, 4, , %result%. Type result?
  352.         IfMsgBox No
  353.             return
  354.         else, Send %result%
  355.     }
  356. Return 
  357. ;} M1
  358. ;{ M1 – Gamepad
  359. NumpadClear & A:: Run IPA.ahk ;M1G1
  360. NumpadClear & B:: ;M1G2 – language selection key
  361.     InputBox scriptName, Enter Script Name, Enter the name of the script you wish to write in: cyrillic`, greek`, kana`, hangul`, cas
  362.     IfExist %scriptName%.ahk
  363.         Run %scriptName%.ahk
  364. Return
  365. NumpadClear & C:: ;M1G3 – fraction key
  366.     ToolTip Enter the fraction (e.g. ⅔ → 23)
  367.     Input fractionCode, L2
  368.     Send % fractions.hasKey(fractionCode) ? fractions[fractionCode] : ""
  369.     ToolTip
  370. Return
  371. NumpadClear & D:: ;M1G4 – superscripts and subscripts
  372.     superMode := (superMode = "none") ? "super"
  373.         : (superMode = "super") ? "sub"
  374.         : "none"
  375.     ToolTip Superscript/subscript mode changed to %superMode%.
  376.     SetTimer, closeToolTip, -2000
  377. Return
  378. ;{ Superscript and Subscript Hotkeys
  379. #If superMode = "super"
  380. 0::⁰
  381. 1::¹
  382. 2::²
  383. 3::³
  384. 4::⁴
  385. 5::⁵
  386. 6::⁶
  387. 7::⁷
  388. 8::⁸
  389. 9::⁹
  390. NumpadSub::Send
  391. NumpadAdd::⁺
  392. #If superMode = "sub"
  393. 0::₀
  394. 1::₁
  395. 2::₂
  396. 3::₃
  397. 4::₄
  398. 5::₅
  399. 6::₆
  400. 7::₇
  401. 8::₈
  402. 9::₉
  403. NumpadSub::Send
  404. NumpadAdd::₊
  405. #If
  406. ;}
  407. NumpadClear & E:: Return ;M1G5
  408. NumpadClear & F:: Return ;M1G6
  409. NumpadClear & G:: ;M1G7 – dictionary
  410.     InputBox, lookupData, Look up word, What is the word you want to look up?
  411.     If ErrorLevel
  412.         return
  413.     Run http://en.wiktionary.org/wiki/%lookupData%
  414. return
  415.  
  416. NumpadClear & H:: Run %comspec% /c "py lunches.py", Z:\Documents\autoHotkey, hide ;M1G8
  417. NumpadClear & I:: Run photofinder.ahk ;M1G9
  418. NumpadClear & J:: Run \\psf\Home\Downloads\%currDate%\ ;M1G10
  419. NumpadClear & K:: Run \\psf\Home\Desktop\Screenshots\%currDate%\ ;M1G11
  420. NumpadClear & L:: Send ^!+p ;M1G12 – Columbus!
  421. NumpadClear & M:: ;M1G13
  422.     DetectHiddenWindows on
  423.     if WinExist("arduino-control.ahk ahk_class AutoHotkey")
  424.         PostMessage 4103
  425.     DetectHiddenWindows off
  426. Return
  427. NumpadClear & N:: ;M1G14
  428.     DetectHiddenWindows on
  429.     if WinExist("arduino-control.ahk ahk_class AutoHotkey")
  430.         PostMessage 4102
  431.     DetectHiddenWindows off
  432. Return
  433.  
  434. NumpadClear & O:: ;M1G15
  435. NumpadClear & P:: ;M1G16
  436. NumpadClear & Q:: ;M1G17
  437. NumpadClear & R:: ;M1G18
  438. NumpadClear & S:: ;M1G19
  439.  
  440. NumpadClear & T:: ;M1G20
  441. NumpadClear & U:: ;M1G21
  442. NumpadClear & V:: ;M1G22
  443. NumpadClear & W:: ;M1G23
  444. NumpadClear & X:: ;M1G24
  445. MsgBox AHK Capture %A_ThisHotkey% (Placeholder)
  446. Return
  447. ;} M1
  448. ;{ M2 – the Paginating Keys
  449. NumpadClear & NumpadSub:: ;The EveryKey
  450. Input code,, {Enter}
  451. ;MsgBox %code%
  452. StringSplit codeBits, code, /
  453. reconstructed = k%codeBits1%p%codeBits2%m%codebits3%
  454. if isLabel(reconstructed)
  455.     gosub %reconstructed%
  456. else
  457.     MsgBox AHK Capture: Paginating Key %reconstructed% (Placeholder)
  458. Return
  459. /*
  460.     Each code creates a command hook with the subroutine name
  461.     kCpPmSCA (page, command, shift, control, alt)
  462.     e.g. page 2, command 20, shift on = k20p1m100:
  463. */
  464. k1p1m000:
  465.     loop {
  466.         URLDownloadToFile http://asie.pl/drama.php?plain, dat\drama.txt
  467.         FileRead, drama, dat\drama.txt
  468.         MsgBox, 259, Minecraft Drama Generator, %drama% `r`n`r`n Another?
  469.         IfMsgBox No
  470.             break
  471.         IfMsgBox Cancel
  472.         {
  473.             send %drama%
  474.             break
  475.         }
  476.     }
  477. Return
  478. k2p1m000:
  479.     key = {xxxxxxxx-xxxx-xxxx-4xxx-xxxxxxxxxxxx}
  480.     loop 31
  481.     {
  482.         Random outputDigit, 0, 15
  483.         outputDigit := (outputDigit = 10 ? "A"
  484.             : outputDigit = 11 ? "B"
  485.             : outputDigit = 12 ? "C"
  486.             : outputDigit = 13 ? "D"
  487.             : outputDigit = 14 ? "E"
  488.             : outputDigit = 15 ? "F"
  489.             : outputDigit)
  490.         StringReplace key, key, x, %outputDigit%
  491.     }
  492.     Send {Raw}%key%
  493. Return
  494. ;} M2
  495. ;{ M3 – Program Specific Keys
  496. ;{ Quassel only commands
  497. #IfWinActive AHK_class QWidget
  498. XButton1:: ;M3G1
  499.     Send /nick isoraqathedh
  500.     GoSub confirm
  501. Return
  502.  
  503. XButton2::Send {down}/msg NickServ identify%A_Space% ;M3G2
  504. +XButton2:: Send {down}/msg NickServ GHOST isoraqathedh%A_Space% ;+M3G2
  505.  
  506. Launch_Mail::ControlClick x218 y846, AHK_class QWidget ;M3G3 Italic (387,846)
  507. +Launch_Mail::ControlClick x194 y846, AHK_class QWidget ;+M3G3 Bold
  508.  
  509. +Browser_Home::Send {down}/away{enter} ;+M3G4
  510. Browser_Home:: ;M3G4
  511.     Send {down}
  512.     InputBox, reason, Input Away Reason, Write reason for away below.,,,,,,,,alis
  513.     If ErrorLevel
  514.         Send, +{Home}{Backspace}
  515.     Else, Send, {backspace}/away %reason%{enter}
  516. Return
  517.  
  518. confirm:
  519.     MsgBox, 4, Confirm IRC Command, Would you like to continue? (press Yes or No)
  520.     IfMsgBox, Yes, Send, {enter}
  521.     Else, Send, +{Home}{Backspace}
  522. Return
  523. ;} Quassel-only commands
  524. ;{ Skype-only commands
  525. #IfWinActive ahk_class tSkMainForm
  526. XButton1::Send !soo ;M3G1
  527. XButton2::Send !soa ;M3G2
  528. Launch_Mail::Send !soi ;M3G3
  529. Browser_Home::Send !sod ;M3G4
  530. ^up:: ;Chat Up
  531.     Send !2
  532.     Sleep 100
  533.     Send {up}{enter}
  534.     Sleep 400
  535.     Send {Ctrl up}
  536. Return
  537. ^down:: ;Chat Down
  538.     Send !2
  539.     Sleep 100
  540.     Send {down}{enter}
  541.     Sleep 400
  542.     Send {Ctrl up}
  543. Return
  544. ;} Skype-only commands
  545. ;{ Notepad++ only commands
  546. #IfWinActive ahk_class Notepad++
  547.     F1::Return
  548.     ;F10::Send {home}color({#}666666){{}{end}{}}
  549.     XButton1::Run HTML.ahk ;M3G1
  550.     XButton2::Run CSS.ahk ;M3G2
  551.     Launch_Mail::Run Javascript.ahk ;M3G3
  552. ;} Notepad++ only commands
  553. ;{ Firefox only commands
  554. #IfWinActive ahk_class MozillaWindowClass
  555. XButton1::Send {Browser_Back} ;M3G1 – Back
  556. XButton2::Send {Browser_Forward} ;M3G2 – Forward
  557. Launch_Mail::Send !tfo ;M3G3 – FoxReplace wordfilter list fun!
  558. Browser_Home:: ;M3G4 – site-specific action
  559.     Clipsaved = %ClipboardAll%
  560.     Sleep 600
  561.     Send !d^x
  562.     IfInString clipboard, zh.wikipedia.org/wiki/
  563.     {
  564.         StringReplace clipboard, clipboard, /wiki/, /zh-hk/
  565.         Send ^v{enter}
  566.     }
  567.     Else, IfInString clipboard, //xkcd.com
  568.     {
  569.         StringReplace Clipboard, Clipboard, https:, http:
  570.         StringReplace Clipboard, Clipboard, xkcd.com, explainxkcd.com
  571.         Send ^v{enter}
  572.     }
  573.     Else, IfInString Clipboard, //tvtropes.org/
  574.     {
  575.         Send !tww
  576.         Sleep 600
  577.         SendRaw,
  578.         ( Join`s
  579.             for (i in document.getElementsByClassName("spoiler")) {
  580.                 document.getElementsByClassName("spoiler")[i].setAttribute("style", " color:black !important; background-color:#DDD;");
  581.                 for (j in document.getElementsByClassName("spoiler")[i].getElementsByTagName(" a"))
  582.                 if (document.getElementsByClassName("spoiler")[i].getElementsByTagName(" a")[j].setAttribute)
  583.                 document.getElementsByClassName("spoiler")[i].getElementsByTagName(" a")[j].setAttribute("style", "color:blue;");
  584.             }
  585.         )
  586.         Send {Enter}
  587.         Sleep 500
  588.         Send !t
  589.         Sleep 1500
  590.         Send ww
  591.     }
  592.     Else, Send {esc}
  593.     Clipboard := clipsaved
  594.     Clipsaved =
  595. Return
  596. ;} Firefox only commands
  597. ;{ Zim-wiki only commands
  598. #IfWinActive - Zim ahk_class gdkWindowToplevel
  599. XButton1::Send !mssss{Enter} ;  M3G1 Superscript
  600. +XButton1::Send !msss{Enter} ; +M3G1 Subscript
  601.  
  602. XButton2::Send !it ; M3G2 Bulleted list
  603. +XButton2::Send !in ;+M3G2 Numbered list
  604.  
  605. Launch_Mail::Send !ii ; M3G3 Add image
  606.  
  607. Launch_App2:: ;M3G6 special keys
  608.     InputBox reason, Special Character Entry Field, Use this text box to input text that the program's text input handler refuses to input.
  609.     Send %reason%
  610. Return
  611. ;} Zim-wiki only commands
  612. ;{ Windows Explorer-only commands
  613. #IfWinActive AHK_class CabinetWClass
  614. XButton1::Send {Browser_Back} ;M3G1 – Back
  615. XButton2::Send {Browser_Forward} ;M3G2 – Forward
  616. Launch_Mail::Send !{up} ;M3G3 – up
  617. ;}
  618. ;{ Emacs-only commands
  619. #IfWinActive ahk_class Emacs
  620. /*
  621. XButton1::Send ^xb{enter} ;M3G1 – file switchback
  622. +XButton1::Send ^c^z^x1 ;+M3G1 – REPL switchback
  623. XButton2::Send ^xb ;M3G2 – file switchback (specified)
  624. Launch_Mail::Send ^xu ;M3G3 – last file
  625. Browser_Home::Send ^x{right} ;M3G4 – next file
  626. +Browser_Home::Send ^x{left} ;+M3G4 – previous file
  627. Launch_Media::Send ^c^c ;M3G5 – compile or cancel
  628. Launch_App2::Send ^x^s ;M3G6 – save
  629. ; Gamepad
  630. NumpadClear & 1::  ;M3G1 – load last called file
  631.     gosub SleepSome
  632.     Send (load +'Z:!p){bs}
  633. Return
  634. NumpadClear & 2::
  635.     gosub SleepSome
  636.     Send +{up}^w^y^y{up} ;M3G2 – clone line
  637. Return
  638. NumpadClear & 3:: ;M3G3 – The RIGHT working directory
  639.     gosub SleepSome
  640.     Send ^x^f^+a^wZ:/Documents/Programming/
  641. Return
  642. NumpadClear & 4:: ;M3G4 – Clear REPL
  643.     gosub SleepSome
  644.     MsgBox 4, Clear REPL, Are you sure?
  645.     IfMsgBox Yes
  646.         Send ^c!o
  647. Return
  648. NumpadClear & F10:: ;M3G20 – cut
  649.     gosub SleepSome
  650.     Send ^w
  651. Return
  652. NumpadClear & F11:: ;M3G21 – copy
  653.     gosub SleepSome
  654.     Send !w
  655. Return
  656. NumpadClear & F12:: ;M3G22 – paste
  657.     gosub SleepSome
  658.     Send ^y
  659. Return
  660.  
  661. SleepSome:
  662.     Sleep 500
  663. Return
  664. */
  665. ; Other
  666. ::d-bind::destructuring-bind
  667. ::m-v-bind::multiple-value-bind
  668. ;} Emacs-only commands
  669. ;{ Scite4AHK only commands
  670.     #IfWinActive ahk_class SciTEWindow
  671.     !0::Send !va ; Fold all
  672.     NumpadAdd::Send {+}
  673.     NumpadSub::Send -
  674. ;}
  675.  
  676. #IfWinActive
  677. ;{ Else
  678. XButton1::         ;M3G1
  679. XButton2::         ;M3G2
  680. Launch_Mail::      ;M3G3
  681. Browser_Home::     ;M3G4
  682. Launch_Media::     ;M3G5
  683. Launch_App2::      ;M3G6
  684. ; Gamepad
  685. NumpadClear & 1::  ;M3G1
  686. NumpadClear & 2::  ;M3G2
  687. NumpadClear & 3::  ;M3G3
  688. NumpadClear & 4::  ;M3G4
  689. NumpadClear & 5::  ;M3G5
  690. NumpadClear & 6::  ;M3G6
  691. NumpadClear & 7::  ;M3G7
  692.  
  693. NumpadClear & 8::  ;M3G8
  694. NumpadClear & 9::  ;M3G9
  695. NumpadClear & 0::  ;M3G10
  696. NumpadClear & F1:: ;M3G11
  697. NumpadClear & F2:: ;M3G12
  698. NumpadClear & F3:: ;M3G13
  699. NumpadClear & F4:: ;M3G14
  700.  
  701. NumpadClear & F5:: ;M3G15
  702. NumpadClear & F6:: ;M3G16
  703. NumpadClear & F7:: ;M3G17
  704. NumpadClear & F8:: ;M3G18
  705. NumpadClear & F9:: ;M3G19
  706.  
  707. NumpadClear & F10:: ;M3G20
  708. NumpadClear & F11:: ;M3G21
  709. NumpadClear & F12:: ;M3G22
  710. NumpadClear & Y:: ;M3G23
  711. NumpadClear & Z:: ;M3G24
  712. SoundBeep
  713. MsgBox Program-specific action keys. This program has yet to have this key assigned for it.
  714. Return
  715.  
  716. ; Also noop Launch_Mail
  717. +Launch_Mail:: Return
  718. ;}
  719. ;} M3
  720. ;{ Media Keys
  721. Volume_Mute::
  722.     IniWrite 1, dat\rename.ini, main, manualt
  723.     MsgBox The next download cleanup session will be manual.
  724. Return
  725. Volume_Up::
  726. ;Return
  727. Volume_Down::
  728. ;Return
  729. Media_Play_Pause::
  730. ;Return
  731. Media_Stop::
  732. ;Return
  733. Media_Prev::
  734. ;Return
  735. Media_Next::
  736. ;Return
  737. SoundBeep
  738. MsgBox AHK Capture %A_ThisHotKey% (Placeholder)
  739. Return
  740. ;} Media Keys
  741. ;} Special Keys
  742.  
  743. ;{ Joystick
  744. Joy1::
  745.  
  746. MsgBox AHK Capture %A_ThisHotkey% (Placeholder)
  747. Return
  748. ;} Joystick
  749.  
  750. ;{ Other
  751.  
  752. makeDate() {
  753.     FormatTime, currTime,, 'Screen Shot' yyyy-MM-dd 'at' HH.mm.ss
  754.     FormatTime, currDate,, yyyy-MM
  755.     IfNotExist, \\psf\Home\Desktop\Screenshots\%currDate%, FileCreateDir,  \\psf\Home\Desktop\Screenshots\%currDate%
  756.     Random randomMillies, 0, 999
  757.     return currTime . "." . SubStr("000" . randomMillies, -2) . ".png"
  758. }
  759.  
  760.  
  761. PrintScreen:: ;Local PrintScreen, regional
  762.     currTime := makeDate()
  763.     Run C:\Program Files (x86)\MiniCap\MiniCap.exe -captureregselect -clipimage -exit -save "\\psf\Home\Desktop\Screenshots\%currTime%"
  764. Return
  765.  
  766. +PrintScreen:: ;Local PrintScreen, global
  767.     currTime := makeDate()
  768.     Run C:\Program Files (x86)\MiniCap\MiniCap.exe -capturedesktop -clipimage -exit -save "\\psf\Home\Desktop\Screenshots\%currTime%"
  769. Return
  770.  
  771. !PrintScreen::Run C:\Program Files (x86)\Gyazo\gyazowin.exe, C:\Program Files (x86)\Gyazo ; Internet Printscreen
  772.  
  773. Pause::Pause
  774. +Pause::Suspend
  775. +#c:: Run crusher.ahk
  776. ;} Other
  777.  
  778. OnExit:
  779. IniWrite, %iter%, _Main.ini, Main, iter
  780. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment