Advertisement
Guest User

Elemenos Multiboxing KeyCloner for World of Warcraft

a guest
Dec 7th, 2015
1,686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.13 KB | None | 0 0
  1. /*
  2. **************************************************************
  3. Elemeno's Keycloner for World of Warcraft [5 boxing edition]
  4. Current Version 12.06.15
  5. Feel free to use / modify this code as needed.
  6. I am distrubuting this free of charge, however, I would certainly
  7. apreciate donations to help me buy a couple of beers!
  8. https://www.paypal.me/lmno
  9. **************************************************************
  10.  
  11. **************************************************************
  12. IMPORTANT STUFF
  13. To close the program use <CTRL>+<SHIFT>+C at anytime
  14. Press 'Pause' to temporarily suspend the program
  15. **************************************************************
  16.  
  17. To Use:
  18. **************************************************************
  19. -Open up to 5 warcraft windows and login to your characters
  20. -Start the program
  21. -Pressing <Shift> and F1 will load Camera Setup #1 [Main Window left side, slaves right side]
  22. -Pressing <Shift> and F2 will load Camera Setup #2 [One window maximized]
  23. -Pressing F1 - F5 will change and focus a new main window
  24. -Pressing <Scroll Lock> will reload the script, use if something gets stuck or stops working
  25. -*note* program will automatically close if you type something when a WoW window is not in focus
  26. This is ON PURPOSE and will help prevent people from typing private messages or sensitive information
  27. to your WoW windows on accident.
  28.  
  29. Special Warcraft Setup:
  30. **************************************************************
  31. This script works heavily dependant on certain macros you have
  32. set up with keybinds in your respective warcraft windows.
  33. Your two characters should be able to jump and activate the standard
  34. shortcut keys but will have a hard time getting around. You will need
  35. to set up some /follow macros, and their is no one *correct* way to do it.
  36. Search the web, forums, etc.. and you will have different people having their
  37. own preferences. I will provide a limited amount below to perform basic
  38. functions / tasks on your two characters.
  39.  
  40. Basic Setup:
  41. **************************************************************
  42. For Wow Instance #1 [Your main character]
  43. - Unbind your arrow movement keys
  44.  
  45. For WoW Instance #2 - #5 [Your slave characters]
  46. - Unbind your standard movement keys Q,W,E,A,S,D
  47. - Bind the movement keys to the arrow keys
  48. - Set up a macro / keybind to the letter 'G' to read the following:
  49. /follow nameofmaincharacter (where 'nameofmaincharacter' is the name of your main character)
  50. /target nameofmaincharacter
  51. /assist nameofmaincharacter
  52. /petfollow nameofmaincharacter [optional]
  53.  
  54. The purpose of this is to allow your second characters to always follow
  55. your main, and your second characters will always target whatever your
  56. main is targeting at the time.
  57. If your main toon selects a new target and want your secondary toons target
  58. to get updated, just press 'G' again. I just prefer 'G'. You can make this
  59. whatever you want.
  60.  
  61. The Basic setup will allow your secondary character to have a /follow and /target
  62. bound to one single key, and allow you to make minor running adjustments by way
  63. of the arrow keys. QWEASD control player #1, UP DOWN LEFT RIGHT arrow keys
  64. will control player #2 [they must be bound properly in your wow keybindings
  65. */
  66.  
  67. ;***********************************************
  68. ;Start
  69. ;***********************************************
  70. #singleinstance force
  71. #MaxHotkeysPerInterval 500
  72. #NoEnv
  73. SetWorkingDir %A_ScriptDir%
  74. title=Elemeno's Multiboxing Keycloner
  75. windowstyle=1
  76. hotkey, ^+c, close
  77. onexit, close
  78. SetBatchLines, -1
  79. WinGet, wowid, List, World of Warcraft
  80. ;***********************************************
  81. ;Menu
  82. ;***********************************************
  83. Menu, tray, add, Window Style #1 [Main / Slaves], window1
  84. Menu, tray, add, Window Style #2 [Main Maximized], window2
  85. menu, tray, tip, %title%
  86. ;disable these if you want borders on your windows. You can disable a line by putting a ; in front of it.
  87. winset, style, -0xC00000 -0x800000 -0x40000, ahk_id %wowid1%
  88. winset, style, -0xC00000 -0x800000, ahk_id %wowid2%
  89. winset, style, -0xC00000 -0x800000, ahk_id %wowid3%
  90. winset, style, -0xC00000 -0x800000, ahk_id %wowid4%
  91. winset, style, -0xC00000 -0x800000, ahk_id %wowid5%
  92. ifwinexist , ahk_id %wowid1%
  93. {
  94. winactivate, ahk_id %wowid1%
  95. winrestore, ahk_id %wowid1%
  96. winmaximize, ahk_id %wowid1%
  97. }
  98. gosub alwaysontop_on
  99. WinGetPos, x1, y1, w1, h1, ahk_id %wowid1%
  100. x_win_1 := 0
  101. y_win_1 := 0
  102. w_win_1 := A_ScreenWidth * .80
  103. h_win_1 := A_ScreenHeight * .963
  104. x_win_2 := A_ScreenWidth * .80
  105. y_win_2 := 0
  106. w_win_2 := A_ScreenWidth * .20
  107. h_win_2 := (A_ScreenHeight * .963) * .25
  108. x_win_3 := A_ScreenWidth * .80
  109. y_win_3 := (A_ScreenHeight * .963) * .25
  110. w_win_3 := A_ScreenWidth * .20
  111. h_win_3 := (A_ScreenHeight * .963) * .25
  112. x_win_4 := A_ScreenWidth * .80
  113. y_win_4 := (A_ScreenHeight * .963) * .50
  114. w_win_4 := A_ScreenWidth * .20
  115. h_win_4 := (A_ScreenHeight * .963) * .25
  116. x_win_5 := A_ScreenWidth * .80
  117. y_win_5 := (A_ScreenHeight * .963) * .75
  118. w_win_5 := A_ScreenWidth * .20
  119. h_win_5 := (A_ScreenHeight * .963) * .25
  120. gosub windowstart
  121. ;***********************************************
  122. ;Pause and Scrolllock hotkeys
  123. ;***********************************************
  124. ~Pause::
  125. Suspend, Toggle
  126. if A_IsSuspended = 1
  127. {
  128. coordmode, tooltip, screen
  129. ToolTip, %title% Suspended, (A_ScreenWidth * .45), (A_ScreenHeight * .85), 1
  130. TrayTip, %title%, SUSPENDED, 1, 1
  131. soundplay, *63
  132. }
  133. if A_IsSuspended = 0
  134. {
  135. ToolTip, , 0, 0, 1
  136. TrayTip, Elemeno's Dual Boxing Keycloner, RUNNING, 1, 1
  137. soundplay, *64
  138. }
  139. Return
  140. ~ScrollLock::
  141. Reload
  142. Return
  143. ;***********************************************
  144. ;Change the main focus window
  145. ;***********************************************
  146. windowstart:
  147. ~F1:: ; Brings Window 1 to the main screen
  148. window1=ahk_id %wowid1%
  149. window2=ahk_id %wowid2%
  150. window3=ahk_id %wowid3%
  151. window4=ahk_id %wowid4%
  152. window5=ahk_id %wowid5%
  153. gosub changewindows
  154. winactivate ahk_id %wowid1%
  155. return
  156. ~F2:: ; Brings Window 2 to the main screen
  157. window1=ahk_id %wowid2%
  158. window2=ahk_id %wowid1%
  159. window3=ahk_id %wowid3%
  160. window4=ahk_id %wowid4%
  161. window5=ahk_id %wowid5%
  162. gosub changewindows
  163. winactivate ahk_id %wowid2%
  164. return
  165. ~F3:: ; Brings Window 2 to the main screen
  166. window1=ahk_id %wowid3%
  167. window2=ahk_id %wowid1%
  168. window3=ahk_id %wowid2%
  169. window4=ahk_id %wowid4%
  170. window5=ahk_id %wowid5%
  171. gosub changewindows
  172. winactivate ahk_id %wowid3%
  173. return
  174. ~F4:: ; Brings Window 2 to the main screen
  175. window1=ahk_id %wowid4%
  176. window2=ahk_id %wowid1%
  177. window3=ahk_id %wowid2%
  178. window4=ahk_id %wowid3%
  179. window5=ahk_id %wowid5%
  180. gosub changewindows
  181. winactivate ahk_id %wowid4%
  182. return
  183. ~F5:: ; Brings Window 2 to the main screen
  184. window1=ahk_id %wowid5%
  185. window2=ahk_id %wowid1%
  186. window3=ahk_id %wowid2%
  187. window4=ahk_id %wowid3%
  188. window5=ahk_id %wowid4%
  189. gosub changewindows
  190. winactivate ahk_id %wowid5%
  191. return
  192. ;***********************************************
  193. ;Swap the main windows based on main focus choice
  194. ;***********************************************
  195. changewindows:
  196. if windowstyle=1
  197. {
  198. winmove, %window1%, ,%x_win_1%, %y_win_1%, %w_win_1%, %h_win_1%
  199. winmove, %window2%, ,%x_win_2%, %y_win_2%, %w_win_2%, %h_win_2%
  200. winmove, %window3%, ,%x_win_3%, %y_win_3%, %w_win_3%, %h_win_3%
  201. winmove, %window4%, ,%x_win_4%, %y_win_4%, %w_win_4%, %h_win_4%
  202. winmove, %window5%, ,%x_win_5%, %y_win_5%, %w_win_5%, %h_win_5%
  203. }
  204. if windowstyle=2
  205. {
  206. winmove, %window1%, ,x1, y1, w1, h1
  207. winmove, %window2%, ,x1, y1, w1, h1
  208. winmove, %window3%, ,x1, y1, w1, h1
  209. winmove, %window4%, ,x1, y1, w1, h1
  210. winmove, %window5%, ,x1, y1, w1, h1
  211. winrestore, %window1%
  212. }
  213. return
  214. ;***********************************************
  215. ;Load the different window profiles
  216. ;***********************************************
  217. window1:
  218. ~+F1:: ; Loads standard window profile
  219. windowstyle = 1
  220. gosub, windowstart
  221. Return
  222. window2:
  223. ~+F2:: ; Forces main window to fullscreen
  224. windowstyle = 2
  225. gosub windowstart
  226. winmove, %window1%, ,x1, y1, w1, h1
  227. Return
  228. ;***********************************************
  229. ;Standard Keyboard keys
  230. ;***********************************************
  231. ~1::
  232. ~2::
  233. ~3::
  234. ~4::
  235. ~5::
  236. ~6::
  237. ~7::
  238. ~8::
  239. ~9::
  240. ~0::
  241. ~-::
  242. ~=::
  243. ~q::
  244. ~w::
  245. ~e::
  246. ~r::
  247. ~t::
  248. ~y::
  249. ~u::
  250. ~i::
  251. ~o::
  252. ~p::
  253. ~[::
  254. ~]::
  255. ~a::
  256. ~s::
  257. ~d::
  258. ~f::
  259. ~g::
  260. ~h::
  261. ~j::
  262. ~k::
  263. ~l::
  264. ;~;::
  265. ~'::
  266. ~z::
  267. ~x::
  268. ~c::
  269. ~v::
  270. ~b::
  271. ~n::
  272. ~m::
  273. ~,::
  274. ~.::
  275. ~`::
  276. ~/::
  277. IfWinActive, ahk_id %wowid1%
  278. {
  279. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  280. ControlSend,, %ThisKey%, ahk_id %wowid2%
  281. ControlSend,, %ThisKey%, ahk_id %wowid3%
  282. ControlSend,, %ThisKey%, ahk_id %wowid4%
  283. ControlSend,, %ThisKey%, ahk_id %wowid5%
  284. Return
  285. }
  286. IfWinActive, ahk_id %wowid2%
  287. {
  288. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  289. ControlSend,, %ThisKey%, ahk_id %wowid1%
  290. ControlSend,, %ThisKey%, ahk_id %wowid3%
  291. ControlSend,, %ThisKey%, ahk_id %wowid4%
  292. ControlSend,, %ThisKey%, ahk_id %wowid5%
  293. Return
  294. }
  295. IfWinActive, ahk_id %wowid3%
  296. {
  297. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  298. ControlSend,, %ThisKey%, ahk_id %wowid1%
  299. ControlSend,, %ThisKey%, ahk_id %wowid2%
  300. ControlSend,, %ThisKey%, ahk_id %wowid4%
  301. ControlSend,, %ThisKey%, ahk_id %wowid5%
  302. Return
  303. }
  304. IfWinActive, ahk_id %wowid4%
  305. {
  306. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  307. ControlSend,, %ThisKey%, ahk_id %wowid1%
  308. ControlSend,, %ThisKey%, ahk_id %wowid2%
  309. ControlSend,, %ThisKey%, ahk_id %wowid3%
  310. ControlSend,, %ThisKey%, ahk_id %wowid5%
  311. Return
  312. }
  313. IfWinActive, ahk_id %wowid5%
  314. {
  315. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  316. ControlSend,, %ThisKey%, ahk_id %wowid1%
  317. ControlSend,, %ThisKey%, ahk_id %wowid2%
  318. ControlSend,, %ThisKey%, ahk_id %wowid3%
  319. ControlSend,, %ThisKey%, ahk_id %wowid4%
  320. Return
  321. }
  322. ;***********************************************
  323. ;Shift + Standard Keyboard keys
  324. ;***********************************************
  325. ~+1::
  326. ~+2::
  327. ~+3::
  328. ~+4::
  329. ~+5::
  330. ~+6::
  331. ~+7::
  332. ~+8::
  333. ~+9::
  334. ~+0::
  335. ~+-::
  336. ~+=::
  337. ~+q::
  338. ~+w::
  339. ~+e::
  340. ~+r::
  341. ~+t::
  342. ~+y::
  343. ~+u::
  344. ~+i::
  345. ~+o::
  346. ~+p::
  347. ~+[::
  348. ~+]::
  349. ~+a::
  350. ~+s::
  351. ~+d::
  352. ~+f::
  353. ~+g::
  354. ~+h::
  355. ~+j::
  356. ~+k::
  357. ~+l::
  358. ;~+;::
  359. ~+'::
  360. ~+z::
  361. ~+x::
  362. ~+c::
  363. ~+v::
  364. ~+b::
  365. ~+n::
  366. ~+m::
  367. ~+,::
  368. ~+.::
  369. ~+`::
  370. ~+/::
  371. IfWinActive, ahk_id %wowid1%
  372. {
  373. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  374. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid2%
  375. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid3%
  376. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid4%
  377. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid5%
  378. Return
  379. }
  380. IfWinActive, ahk_id %wowid2%
  381. {
  382. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  383. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid1%
  384. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid3%
  385. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid4%
  386. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid5%
  387. Return
  388. }
  389. IfWinActive, ahk_id %wowid3%
  390. {
  391. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  392. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid1%
  393. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid2%
  394. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid4%
  395. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid5%
  396. Return
  397. }
  398. IfWinActive, ahk_id %wowid4%
  399. {
  400. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  401. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid1%
  402. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid2%
  403. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid3%
  404. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid5%
  405. Return
  406. }
  407. IfWinActive, ahk_id %wowid5%
  408. {
  409. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  410. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid1%
  411. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid2%
  412. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid3%
  413. ControlSend,, {shift down}%thiskey%{shift up}, ahk_id %wowid4%
  414. Return
  415. }
  416. ;***********************************************
  417. ;Control + Standard Keyboard keys
  418. ;***********************************************
  419. ~^1::
  420. ~^2::
  421. ~^3::
  422. ~^4::
  423. ~^5::
  424. ~^6::
  425. ~^7::
  426. ~^8::
  427. ~^9::
  428. ~^0::
  429. ~^-::
  430. ~^=::
  431. ~^q::
  432. ~^w::
  433. ~^e::
  434. ~^r::
  435. ~^t::
  436. ~^y::
  437. ~^u::
  438. ~^i::
  439. ~^o::
  440. ~^p::
  441. ~^[::
  442. ~^]::
  443. ~^a::
  444. ~^s::
  445. ~^d::
  446. ~^f::
  447. ~^g::
  448. ~^h::
  449. ~^j::
  450. ~^k::
  451. ~^l::
  452. ;~^;::
  453. ~^'::
  454. ~^z::
  455. ~^x::
  456. ~^c::
  457. ~^v::
  458. ~^b::
  459. ~^n::
  460. ~^m::
  461. ~^,::
  462. ~^.::
  463. ~^`::
  464. ~^/::
  465. IfWinActive, ahk_id %wowid1%
  466. {
  467. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  468. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid2%
  469. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid3%
  470. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid4%
  471. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid5%
  472. Return
  473. }
  474. IfWinActive, ahk_id %wowid2%
  475. {
  476. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  477. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid1%
  478. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid3%
  479. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid4%
  480. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid5%
  481. Return
  482. }
  483. IfWinActive, ahk_id %wowid3%
  484. {
  485. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  486. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid1%
  487. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid2%
  488. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid4%
  489. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid5%
  490. Return
  491. }
  492. IfWinActive, ahk_id %wowid4%
  493. {
  494. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  495. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid1%
  496. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid2%
  497. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid3%
  498. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid5%
  499. Return
  500. }
  501. IfWinActive, ahk_id %wowid5%
  502. {
  503. StringTrimLeft, ThisKey, A_ThisHotKey, 1
  504. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid1%
  505. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid2%
  506. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid3%
  507. ControlSend,, {control down}%thiskey%{control up}, ahk_id %wowid4%
  508. Return
  509. }
  510. ;***********************************************
  511. ;Start of Special Hotkeys
  512. ;***********************************************
  513. ~Enter::
  514. hotkey=enter
  515. gosub hotkeypress
  516. return
  517. ~Tab::
  518. hotkey=Tab
  519. gosub hotkeypress
  520. return
  521. ~Delete::
  522. hotkey=Delete
  523. gosub hotkeypress
  524. return
  525. ~BackSpace::
  526. hotkey=Backspace
  527. gosub hotkeypress
  528. return
  529. ~Escape::
  530. hotkey=Escape
  531. gosub hotkeypress
  532. return
  533. ~Numpad0::
  534. hotkey=Numpad0
  535. gosub hotkeypress
  536. return
  537. ~Numpad1::
  538. hotkey=Numpad1
  539. gosub hotkeypress
  540. return
  541. ~Numpad2::
  542. hotkey=Numpad2
  543. gosub hotkeypress
  544. return
  545. ~Numpad3::
  546. hotkey=Numpad3
  547. gosub hotkeypress
  548. return
  549. ~Numpad4::
  550. hotkey=Numpad4
  551. gosub hotkeypress
  552. return
  553. ~Numpad5::
  554. hotkey=Numpad5
  555. gosub hotkeypress
  556. return
  557. ~Numpad6::
  558. hotkey=Numpad6
  559. gosub hotkeypress
  560. return
  561. ~Numpad7::
  562. hotkey=Numpad7
  563. gosub hotkeypress
  564. return
  565. ~Numpad8::
  566. hotkey=Numpad8
  567. gosub hotkeypress
  568. return
  569. ~Numpad9::
  570. hotkey=Numpad9
  571. gosub hotkeypress
  572. return
  573. ~NumpadSub::
  574. hotkey=NumpadSub
  575. gosub hotkeypress
  576. return
  577. ~NumpadAdd::
  578. hotkey=NumpadAdd
  579. gosub hotkeypress
  580. return
  581. ~NumpadEnter::
  582. hotkey=NumpadEnter
  583. gosub hotkeypress
  584. return
  585. ~NumpadDot::
  586. hotkey=NumpadDot
  587. gosub hotkeypress
  588. return
  589. ~NumpadDiv::
  590. hotkey=NumpadDiv
  591. gosub hotkeypress
  592. return
  593. ~NumpadMult::
  594. hotkey=NumpadMult
  595. gosub hotkeypress
  596. return
  597. ~Up::
  598. hotkey=Up
  599. gosub hotkeypress1
  600. return
  601. ~Down::
  602. hotkey=down
  603. gosub hotkeypress1
  604. return
  605. ~Left::
  606. hotkey=Left
  607. gosub hotkeypress1
  608. return
  609. ~Right::
  610. hotkey=right
  611. gosub hotkeypress1
  612. return
  613. ~Space::
  614. hotkey=space
  615. gosub hotkeypress1
  616. return
  617. ;***********************************************
  618. ;Hotkey subroutine for standard buttons
  619. ;***********************************************
  620. hotkeypress:
  621. ifwinactive, ahk_id %wowid1%
  622. {
  623. ControlSend,, {%hotkey%}, ahk_id %wowid2%
  624. ControlSend,, {%hotkey%}, ahk_id %wowid3%
  625. ControlSend,, {%hotkey%}, ahk_id %wowid4%
  626. ControlSend,, {%hotkey%}, ahk_id %wowid5%
  627. }
  628. ifwinactive, ahk_id %wowid2%
  629. {
  630. ControlSend,, {%hotkey%}, ahk_id %wowid1%
  631. ControlSend,, {%hotkey%}, ahk_id %wowid3%
  632. ControlSend,, {%hotkey%}, ahk_id %wowid4%
  633. ControlSend,, {%hotkey%}, ahk_id %wowid5%
  634. }
  635. ifwinactive, ahk_id %wowid3%
  636. {
  637. ControlSend,, {%hotkey%}, ahk_id %wowid1%
  638. ControlSend,, {%hotkey%}, ahk_id %wowid2%
  639. ControlSend,, {%hotkey%}, ahk_id %wowid4%
  640. ControlSend,, {%hotkey%}, ahk_id %wowid5%
  641. }
  642. ifwinactive, ahk_id %wowid4%
  643. {
  644. ControlSend,, {%hotkey%}, ahk_id %wowid1%
  645. ControlSend,, {%hotkey%}, ahk_id %wowid2%
  646. ControlSend,, {%hotkey%}, ahk_id %wowid3%
  647. ControlSend,, {%hotkey%}, ahk_id %wowid5%
  648. }
  649. ifwinactive, ahk_id %wowid5%
  650. {
  651. ControlSend,, {%hotkey%}, ahk_id %wowid1%
  652. ControlSend,, {%hotkey%}, ahk_id %wowid2%
  653. ControlSend,, {%hotkey%}, ahk_id %wowid3%
  654. ControlSend,, {%hotkey%}, ahk_id %wowid4%
  655. }
  656. return
  657. ;***********************************************
  658. ;Hotkey subroutine for special buttons
  659. ;***********************************************
  660. hotkeypress1:
  661. IfWinActive, ahk_id %wowid1%
  662. {
  663. ControlSend,, {%hotkey% down}, ahk_id %wowid2%
  664. ControlSend,, {%hotkey% down}, ahk_id %wowid3%
  665. ControlSend,, {%hotkey% down}, ahk_id %wowid4%
  666. ControlSend,, {%hotkey% down}, ahk_id %wowid5%
  667. loop
  668. {
  669. getkeystate, state, %hotkey%
  670. if state = U
  671. break
  672. }
  673. ControlSend,, {%hotkey% up}, ahk_id %wowid2%
  674. ControlSend,, {%hotkey% up}, ahk_id %wowid3%
  675. ControlSend,, {%hotkey% up}, ahk_id %wowid4%
  676. ControlSend,, {%hotkey% up}, ahk_id %wowid5%
  677. Return
  678. }
  679. IfWinActive, ahk_id %wowid2%
  680. {
  681. ControlSend,, {%hotkey% down}, ahk_id %wowid1%
  682. ControlSend,, {%hotkey% down}, ahk_id %wowid3%
  683. ControlSend,, {%hotkey% down}, ahk_id %wowid4%
  684. ControlSend,, {%hotkey% down}, ahk_id %wowid5%
  685. loop
  686. {
  687. getkeystate, state, %hotkey%
  688. if state = U
  689. break
  690. }
  691. ControlSend,, {%hotkey% up}, ahk_id %wowid1%
  692. ControlSend,, {%hotkey% up}, ahk_id %wowid3%
  693. ControlSend,, {%hotkey% up}, ahk_id %wowid4%
  694. ControlSend,, {%hotkey% up}, ahk_id %wowid5%
  695. Return
  696. }
  697. IfWinActive, ahk_id %wowid3%
  698. {
  699. ControlSend,, {%hotkey% down}, ahk_id %wowid1%
  700. ControlSend,, {%hotkey% down}, ahk_id %wowid2%
  701. ControlSend,, {%hotkey% down}, ahk_id %wowid4%
  702. ControlSend,, {%hotkey% down}, ahk_id %wowid5%
  703. loop
  704. {
  705. getkeystate, state, %hotkey%
  706. if state = U
  707. break
  708. }
  709. ControlSend,, {%hotkey% up}, ahk_id %wowid1%
  710. ControlSend,, {%hotkey% up}, ahk_id %wowid2%
  711. ControlSend,, {%hotkey% up}, ahk_id %wowid4%
  712. ControlSend,, {%hotkey% up}, ahk_id %wowid5%
  713. Return
  714. }
  715. IfWinActive, ahk_id %wowid4%
  716. {
  717. ControlSend,, {%hotkey% down}, ahk_id %wowid1%
  718. ControlSend,, {%hotkey% down}, ahk_id %wowid2%
  719. ControlSend,, {%hotkey% down}, ahk_id %wowid3%
  720. ControlSend,, {%hotkey% down}, ahk_id %wowid5%
  721. loop
  722. {
  723. getkeystate, state, %hotkey%
  724. if state = U
  725. break
  726. }
  727. ControlSend,, {%hotkey% up}, ahk_id %wowid1%
  728. ControlSend,, {%hotkey% up}, ahk_id %wowid2%
  729. ControlSend,, {%hotkey% up}, ahk_id %wowid3%
  730. ControlSend,, {%hotkey% up}, ahk_id %wowid5%
  731. Return
  732. }
  733. IfWinActive, ahk_id %wowid5%
  734. {
  735. ControlSend,, {%hotkey% down}, ahk_id %wowid1%
  736. ControlSend,, {%hotkey% down}, ahk_id %wowid2%
  737. ControlSend,, {%hotkey% down}, ahk_id %wowid3%
  738. ControlSend,, {%hotkey% down}, ahk_id %wowid4%
  739. loop
  740. {
  741. getkeystate, state, %hotkey%
  742. if state = U
  743. break
  744. }
  745. ControlSend,, {%hotkey% up}, ahk_id %wowid1%
  746. ControlSend,, {%hotkey% up}, ahk_id %wowid2%
  747. ControlSend,, {%hotkey% up}, ahk_id %wowid3%
  748. ControlSend,, {%hotkey% up}, ahk_id %wowid4%
  749. Return
  750. }
  751. ;***********************************************
  752. ;Closing the program
  753. ;***********************************************
  754. close:
  755. winset, alwaysontop, off, ahk_id %wowid1%
  756. winset, alwaysontop, off, ahk_id %wowid2%
  757. winset, alwaysontop, off, ahk_id %wowid3%
  758. winset, alwaysontop, off, ahk_id %wowid4%
  759. winset, alwaysontop, off, ahk_id %wowid5%
  760. winset, style, +0xC00000 +0x800000, ahk_id %wowid1%
  761. winset, style, +0xC00000 +0x800000, ahk_id %wowid2%
  762. winset, style, +0xC00000 +0x800000, ahk_id %wowid3%
  763. winset, style, +0xC00000 +0x800000, ahk_id %wowid4%
  764. winset, style, +0xC00000 +0x800000, ahk_id %wowid5%
  765. winrestore, ahk_id %wowid1%
  766. winrestore, ahk_id %wowid2%
  767. winrestore, ahk_id %wowid3%
  768. winrestore, ahk_id %wowid4%
  769. winrestore, ahk_id %wowid5%
  770. exitapp
  771. ;***********************************************
  772. ;Force windows to stay in foreground
  773. ;***********************************************
  774. alwaysontop_on:
  775. winset, alwaysontop, on, ahk_id %wowid1%
  776. winset, alwaysontop, on, ahk_id %wowid2%
  777. winset, alwaysontop, on, ahk_id %wowid3%
  778. winset, alwaysontop, on, ahk_id %wowid4%
  779. winset, alwaysontop, on, ahk_id %wowid5%
  780. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement