Advertisement
Guest User

rawm

a guest
Sep 14th, 2014
833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. #Persistent
  3. #SingleInstance, force
  4. #InstallKeybdHook
  5. #UseHook
  6. SetBatchLines, -1
  7. SendMode, Input
  8.  
  9. CoordMode,Mouse,Window
  10. CoordMode,Pixel,Window
  11.  
  12. SetWorkingDir, %A_ScriptDir%
  13. OnMessage(0x201,"GuiMove")
  14.  
  15. Menu, Tray, Icon, Images\Rawm.ico
  16. Menu, Tray, Tip, Rawm v2.3.6`nMade by Wickster
  17.  
  18. Version = v2.3.6
  19. Date = 14.09.2014
  20. Credits=tidbit, Snow_Flake, Latem5, AfterLemon, Tomoe_Uehara and Cappuccino
  21.  
  22. if not A_IsAdmin
  23.     Run *RunAs "%A_ScriptFullPath%"
  24. MyToggle:=FALSE
  25.  
  26. ;=========================================================================================================================================================
  27. ;===Variables=============================================================================================================================================
  28. ;=========================================================================================================================================================
  29. ;Variables that are dependent of the Resolution
  30.  
  31.  
  32. ;Clicks Play
  33. x1 := % Round(701 / (800 / w))
  34. y1 := % Round(533 / (600 / h))
  35. ;Clicks Username
  36. x2 := % Round(188 / (1280 / w))
  37. y2 := % Round(321 / (800 / h))
  38. ;Clicks Password
  39. x3 := % Round(147 / (1280 / w))
  40. y3 := % Round(382 / (800 / h))
  41. ;Clicks Login
  42. x4 := % Round(361 / (1280 / w))
  43. y4 := % Round(426 / (800 / h))
  44. ;AutoAccept
  45. x5 := % Round(538 / (1280 / w))  
  46. y5 := % Round(447 / (800 / h))    
  47. ;Check coordinates ready to click play  
  48. x6 := % Round(690 / (800 / w))
  49. y6 := % Round(505 / (600 / h))
  50. ;Check coordinates for username  
  51. x7 := % Round(79 / (1280 / w))
  52. y7 := % Round(723 / (800 / h))
  53.  
  54. ;=================================================================================================
  55. ;===GUI1==========================================================================================
  56.  
  57.  
  58.   IfNotExist, RAWM.config
  59.   {
  60.     goto, menugui
  61.   } else
  62.   { FileReadLine, Toggle, RAWM.config, 1
  63.     FileReadLine, Max, RAWM.config, 2
  64.     FileReadLine, ExitKey, RAWM.config, 3
  65.     FileReadLine, Username1, RAWM.config, 4
  66.     FileReadLine, Password1, RAWM.config, 5
  67.     FileReadLine, Username2, RAWM.config, 6
  68.     FileReadLine, Password2, RAWM.config, 7
  69.     FileReadLine, Username3, RAWM.config, 8
  70.     FileReadLine, Password3, RAWM.config, 9
  71.     FileReadLine, Only1Account, RAWM.config, 10
  72.     FileReadLine, InstallLocation, RAWM.config, 11
  73.     FileReadLine, AutoAccept, RAWM.config, 12
  74.     FileReadLine, DeleteConfig, RAWM.config, 13
  75.     Hotkey, %Toggle%, Main
  76.     Hotkey, %ExitKey%, ButtonAbort!
  77.     Hotkey, %Max%, Max
  78.     Hotkey, %AutoAccept%, AutoAccept
  79.     Hotkey, %DeleteConfig%, DeleteConfig
  80.     goto, rightclickmenu
  81. }  
  82.  
  83. menugui:
  84.  Gui 1: -border hwndGUIHwnd
  85.   Gui 1: Add, Picture, x0 y0, Images\Gui1.png
  86.   Gui 1: Add, Text, x150 y399 cWhite -Theme 0x8000, Check this box if only 1 account
  87.   Gui 1: Add, Checkbox, x320 y400 w23 vOnly1Account
  88.   Gui 1: Add, Text, x175 y426 cWhite -Theme 0x8000, To Start / Re-Start League
  89.   Gui 1: Add, Hotkey, x320 y424 w100 h20 vToggle, F10
  90.   Gui 1: Add, Text, x80 y451 cWhite -Theme 0x8000, To Maximize League (If it opened in the corner)
  91.   Gui 1: Add, Hotkey, x320 y449  w100 h20 vMax, F11
  92.   Gui 1: Add, Text, x218 y476 cWhite -Theme 0x8000, Script Exit Hotkey
  93.   Gui 1: Add, Hotkey, x320 y474 w100 h20 vExitKey, ^!Esc
  94.   Gui 1: Add, Text, x138 y501 cWhite -Theme 0x8000, League of Legends install location:
  95.  Gui 1: Add, Edit, x320 y499 w150 h15 r1 vInstallLocation, C:\Riot Games\League of Legends\
  96.   Gui 1: Add, Text, x206 y527 cWhite -Theme 0x8000, Auto Accept Hotkey
  97.   Gui 1: Add, Hotkey, x320 y525 w100 h20 vAutoAccept, F9
  98.   Gui 1: Add, Text, x182 y553 cWhite -Theme 0x8000, Delete Config File Hotkey
  99.   Gui 1: Add, Hotkey, x320 y551 w100 h20 vDeleteConfig, ^!F5
  100.   Gui 1: Add, Text, x170 y310 cWhite -Theme 0x8000, Username:
  101.  Gui 1: Add, Edit, x230 y305 w90 h15 r1 vUsername1,
  102.   Gui 1: Add, Text, x172 y340 cWhite -Theme 0x8000, Password:
  103.  Gui 1: Add, Edit, x230 y335 w90 h15 r1 vPassword1 +Password,  
  104.   Gui 1: Add, Text, x23 y305 cWhite -Theme 0x8000, Username:
  105.  Gui 1: Add, Edit, x77 y300 w70 h15 r1 vUsername2,
  106.   Gui 1: Add, Text, x25 y335 cWhite -Theme 0x8000, Password:
  107.  Gui 1: Add, Edit, x77 y330 w70 h15 r1 vPassword2 +Password,
  108.   Gui 1: Add, Text, x344 y305 cWhite -Theme 0x8000, Username:
  109.  Gui 1: Add, Edit, x400 y300 w70 h15 r1 vUsername3,
  110.   Gui 1: Add, Text, x346 y335 cWhite -Theme 0x8000, Password:
  111.  Gui 1: Add, Edit, x400 y330 w70 h15 r1 vPassword3 +Password,  
  112.   Gui 1: Add, Button, x375 y660 w80 h25 -Theme 0x8000 gButtonDone, Done
  113.   Gui 1: Add, Button, x275 y660 w80 h25 -Theme 0x8000 gButtonAbort!, Abort!
  114.   Gui 1: Add, Button, x15 y660 w80 h25 -Theme 0x8000 gContactUs, Contact Us
  115.   Gui 1: Color, 232124
  116.   Gui 1: +LastFound +AlwaysOnTop -Caption +ToolWindow
  117.   Gui 1: Show,  w500 h700, Configgui1
  118.   GuiControl 1: +Default, Done
  119.  
  120.  
  121.  
  122. ;===Right-Click Menu==============================================================================
  123. rightclickmenu:
  124. Menu, tray, nostandard
  125. Menu, Tray, add, Menu, MENU
  126. Menu, Tray, add, List of Hotkeys, HOTKEYS
  127. Menu, tray, add, &About, ABOUT
  128. Menu, tray, add
  129. Menu, tray, add, Reload This Script, RELOAD
  130. Menu, tray, add, Pause Script, PAUSE
  131. Menu, tray, add, Exit, EXIT
  132. Menu, tray, Default, MENU
  133. Return
  134.  
  135. MENU:
  136.     Goto, menugui
  137.   Return
  138. RELOAD:
  139.     Reload
  140. Return
  141.  
  142. PAUSE:
  143.     Pause Toggle
  144. Return
  145.  
  146. EXIT:
  147.     ExitApp
  148. Return
  149.  
  150. HOTKEYS:
  151.    ;===Replace special characters in the hotkeys for the message boxes or any other user output
  152.     StringReplace, chrDeleteConfig, DeleteConfig, ^, Ctrl +%A_Space%, All
  153.     StringReplace, chrDeleteConfig, chrDeleteConfig, !, Alt +%A_Space% , All
  154.     StringReplace, chrExitKey, ExitKey, ^, Ctrl +%A_Space%, All
  155.     StringReplace, chrExitKey, chrExitKey, !, Alt +%A_Space%, All
  156.  
  157.     Msgbox,,RAWM v2.3 - Hotkeys, Delete Config File : %chrDeleteConfig%`nAuto Accept : %AutoAccept%`nScript Toggle : %Toggle%`nScript Window Maximize : %Max%`nScript Exit : %chrExitKey%`nLeague Install Location : %InstallLocation%`n
  158. return
  159.  
  160. ABOUT:
  161.  Version=v2.3
  162.   Date=03.04.2014
  163.   Credits=tidbit, Snow_Flake, Latem5, AfterLemon, Tomoe_Uehara and Cappuccino
  164.   MsgBox,, RAWM v2.3 - About, League of Legends Script RAWM v2.3 by Wickster`nVersion:  %Version%`nDate:  %Date%`nCredits: %Credits%
  165. return
  166.  
  167.  
  168. ;===Buttons=======================================================================================
  169. ContactUs:
  170.    Gui 3: -border hwndGUIHwnd
  171.     Gui 3: Add, text, xp+8 yp+25 cBlue gForumLink, http://www.autohotkey.com/board/topic/95636-rawm-v20/
  172.     Gui 3: Add, text, xp   yp+20 cBlue gEmailLink, Email us @ rawm4league@gmail.com
  173.     Gui 3: Add, Button, x160 y70 w100 h25 -Theme 0x8000 gButtonAbort!, Ok
  174.     GuiControl 3: +Default, Ok
  175.     Gui 3: +LastFound +AlwaysOnTop -Caption +ToolWindow
  176.     Gui 3: Show,  w320 h100, Configgui3
  177.     Return
  178.    
  179.    
  180. ForumLink:
  181.    Run http://www.autohotkey.com/board/topic/95636-rawm-v20/
  182.     Exitapp
  183.     Return
  184.    
  185.    
  186. EmailLink:
  187.    clipboard = rawm4league@gmail.com
  188.     msgbox,0x40000,,Email has been copied! Press Crtl+V to paste!
  189.     ExitApp
  190.     Return
  191.    
  192. ButtonAbort!:
  193.     SoundPlay, ButtonNoise.wav, wait
  194.     ExitApp
  195.     return
  196.  
  197. DeleteConfig:
  198.     SoundPlay, FileDeleteNoise.wav, wait
  199.     FileDelete, RAWM.config
  200.     ExitApp
  201.     Return
  202.  
  203. ButtonDone:
  204.  
  205.    
  206.     SoundPlay, ButtonNoise.wav, wait
  207.     Gui 1: Submit, NoHide
  208.     FileDelete, RAWM.config
  209.     FileAppend, %Toggle%`n%Max%`n%ExitKey%`n%Username1%`n%Password1%`n%Username2%`n%Password2%`n%Username3%`n%Password3%`n%Only1Account%`n%InstallLocation%`n%AutoAccept%`n%DeleteConfig%, RAWM.config
  210.     Gui 1: Destroy
  211.  
  212.    ; Msgbox,,RAWM v2.3 - Hotkeys, Delete Config File Hotkey : %chrDeleteConfig%`nAuto Accept Hotkey : %AutoAccept%`nScript Toggle Key : %Toggle%`nScript Window Maximize Key : %Max%`nScript Exit Key : %chrExitKey%`nLeague Install Location : %InstallLocation%`n
  213.     ;SoundPlay, ButtonNoise.wav, wait
  214.  
  215.     If (Only1Account=0)
  216.     { CustomColor = 444444
  217.       Gui 2: Color, %CustomColor%
  218.       WinSet, TransColor, %CustomColor% 255, Configgui2
  219.       Gui 2: Add, Picture, x0 y0 w500 h135, Images\Gui2-2.png
  220.       Gui 2: Add, Picture, x50 y20 w70 h70 gAlternate1, Images\Gui2-Alt1.png
  221.       Gui 2: Add, Picture, x210 y15 w83 h83 gMainAccount, Images\Gui2-Main.png
  222.       Gui 2: Add, Picture, x380 y20 w70 h70 gAlternate2, Images\Gui2-Alt2.png
  223.       Gui 2: Add, Picture, x480 y0 w20 h20 gCancel, Images\Cancel.png
  224.       Gui 2: +LastFound +AlwaysOnTop -Caption +ToolWindow
  225.       Gui 2: Show, w500 h135, Configgui2
  226.       Return
  227.     } Return
  228.  
  229. ;===Main==========================================================================================
  230.  
  231. Main:
  232.  If (Only1Account=0)
  233.   { CustomColor=444444
  234.     Gui 2: Color, %CustomColor%
  235.     WinSet, TransColor, %CustomColor% 255, Configgui2
  236.     Gui 2: Add, Picture, x0 y0 w500 h135, Images\Gui2-2.png
  237.     Gui 2: Add, Picture, x50 y20 w70 h70 gAlternate1, Images\Gui2-Alt1.png
  238.     Gui 2: Add, Picture, x210 y15 w83 h83 gMainAccount, Images\Gui2-Main.png
  239.     Gui 2: Add, Picture, x380 y20 w70 h70 gAlternate2, Images\Gui2-Alt2.png
  240.     Gui 2: Add, Picture, x480 y0 w20 h20 gCancel, Images\Cancel.png
  241.     Gui 2: +LastFound +AlwaysOnTop -Caption +ToolWindow
  242.     Gui 2: Show, w500 h135, Configgui2
  243.     Return
  244.   }
  245.   Login(username1,password1,InstallLocation)
  246.   return
  247.  
  248. ;===MainAccount , Alternate1 and Alternate2======================================================
  249.  
  250. Alternate1:
  251. Login(username2,password2,InstallLocation)
  252. return
  253.  
  254. Alternate2:
  255. Login(username3,password3,InstallLocation)
  256. return
  257.  
  258. MainAccount:
  259. Login(username1,password1,InstallLocation)
  260. return
  261.  
  262.   ;===Login Routine in a function===================================================================
  263.   Login(username, password, installloc)
  264.   {
  265.     global
  266.     SoundPlay, ButtonNoise.wav, wait
  267.     Gui 2: Submit, NoHide
  268.     Gui 2: Destroy
  269.   ;===Kills League of Legends=====================================================================
  270.   IfWinExist, ahk_class ApolloRuntimeContentWindow
  271.   { Runwait, taskkill /f /im LoLLauncher.exe,, Hide
  272.     sleep, 250
  273.     Runwait, taskkill /f /im LolClient.exe,, Hide
  274.     sleep, 250
  275.   } else IfWinExist, ahk_class RADSWindowClass
  276.   { Runwait, taskkill /f /im LoLLauncher.exe,, Hide
  277.     sleep, 250
  278.     Runwait, taskkill /f /im LolClient.exe,, Hide
  279.     sleep, 250
  280.   } else IfWinExist, ahk_class LOLPATCHER
  281.   { Runwait, taskkill /f /im LoLLauncher.exe,, Hide
  282.     sleep, 250
  283.     Runwait, taskkill /f /im LolClient.exe,, Hide
  284.     sleep, 250
  285.   }
  286.  
  287.   ;===Runs League of Legends======================================================================
  288.   Run, lol.launcher.exe,%installloc%
  289.   sleep, 2500
  290.  
  291.   ;===Clicks Play=================================================================================
  292.   WinWaitActive ahk_class LOLPATCHER
  293.   WinGetPos,,, w, h, A
  294.   Sleep 2000
  295.   WinActivate ahk_class LOLPATCHER
  296.   PixelGetColor, c_Play, % Round(704 / (1280 / w)), % Round(16 / (800 / h))
  297.     if c_Play = 0x1580E6
  298.     {
  299.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  300.       Goto, Login
  301.     }
  302.     else if c_Play = 0x1167B8
  303.     {
  304.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  305.       Goto, Login
  306.     }
  307.     else if c_Play = 0x117DDC
  308.     {
  309.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  310.       Goto, Login
  311.     }
  312.     else if c_Play = 0x0E64B0
  313.     {
  314.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  315.       Goto, Login
  316.     }
  317.   TrayTip,, It seems like that LoL is updating right now.`nPlease focus the LoL window when the update is finished to proceed.`nYou can do something else in the meantime., 17
  318.  
  319.   Loop
  320.   {
  321.     WinWaitActive ahk_class LOLPATCHER
  322.     PixelGetColor, c_Playy, % Round(704 / (1280 / w)), % Round(16 / (800 / h))
  323.     if c_Play = 0x1580E6
  324.     {
  325.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  326.       break
  327.     }
  328.     else if c_Playy = 0x1167B8
  329.     {
  330.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  331.       break
  332.     }
  333.     else if c_Playy = 0x117DDC
  334.     {
  335.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  336.       break
  337.     }
  338.     else if c_Playy = 0x0E64B0
  339.     {
  340.       MouseClick, left, % Round(638 / (1280 / w)), % Round(36 / (800 / h)),,0
  341.       break
  342.     }
  343.  
  344.    
  345.     PixelGetColor, c_Agree, % Round(860 / (1280 / w)), % Round(166 / (800 / h))
  346.     if c_Agree = 0x261C0B
  347.     {
  348.       MouseClick, left, % Round(514 / (1280 / w)), % Round(631 / (800 / h)),,0
  349.     }
  350.     Sleep 1000
  351.   }
  352.  
  353.   ;===Waits, till the windows is loaded completely==============================================
  354.   Login:
  355.  WinWaitActive ahk_class ApolloRuntimeContentWindow
  356.   WinGetPos,,, w, h, A
  357.   Loop
  358.   {
  359.     WinActivate ahk_class ApolloRuntimeContentWindow
  360.     PixelGetColor, c_User, % Round(79 / (1280 / w)) ,% Round(723 / (800 / h))
  361.     if c_User contains 0x2
  362.     {
  363.       Sleep, 1000
  364.       MouseClick, Left, % Round(188 / (1280 / w)), % Round(321 / (800 / h))
  365.       MouseClick, Left, % Round(188 / (1280 / w)), % Round(321 / (800 / h))
  366.       break
  367.     }
  368.     Sleep 1000
  369.     b++
  370.     if b=50
  371.     {
  372.       MsgBox, Something went wrong, please restart the Script and try again.`nIf it also fails the next time, please report that error to Wickster.`nhttp://www.autohotkey.com/board/user/24119-wickster/
  373.       break
  374.     }
  375.   }
  376.   ;===Clicks the Username Area====================================================================
  377.   Sleep, 1000
  378.   MouseClick, Left, % Round(188 / (1280 / w)), % Round(321 / (800 / h))
  379.   MouseClick, Left, % Round(188 / (1280 / w)), % Round(321 / (800 / h))
  380.   Sleep, 500
  381.  
  382.   ;===Types the Username==========================================================================
  383.   SetKeyDelay, 5, 5
  384.   Sleep, 1000
  385.   Send, %username%
  386.  
  387.   ;===Clicks the Password Area====================================================================
  388.   WinWaitActive ahk_class ApolloRuntimeContentWindow
  389.   WinGetPos,,, w, h, A
  390.   Sleep, 1000
  391.   MouseClick, left, % Round(147 / (1280 / w)), % Round(382 / (800 / h)),,0
  392.   Sleep, 1000
  393.  
  394.   ;===Types Password==============================================================================
  395.   SetKeyDelay, 5, 5
  396.   Sleep, 100
  397.   Send, %password%
  398.   Sleep, 600
  399.  
  400.   ;===Clicks Login================================================================================
  401.   WinGetPos,,, w, h, A
  402.   MouseClick, Left, % Round(361 / (1280 / w)), % Round(426 / (800 / h)),,0
  403.   Hotkey, %Max%, Max
  404.   Hotkey, %ExitKey%, ButtonAbort!
  405.   Hotkey, %Toggle%, Main
  406.   Hotkey, %AutoAccept%, AutoAccept
  407.   Hotkey, %DeleteConfig%, DeleteConfig
  408.  
  409.   return
  410. }
  411.  
  412. ;===Maximizes League Window======================================================================
  413. Max:
  414.  IfWinExist, ahk_class RiotWindowClass
  415.     Winmaximize, ahk_class RiotWindowClass
  416.   else
  417.   { Hotkey, %Max%, Max
  418.     Hotkey, %ExitKey%, ButtonAbort!
  419.     Hotkey, %Toggle%, Main
  420.     Hotkey, %AutoAccept%, AutoAccept
  421.     Hotkey, %DeleteConfig%, DeleteConfig
  422.   } return
  423.  
  424. ;===Auto Accept===================================================================================
  425. AutoAccept:
  426.  if (MyToggle)
  427.   { TrayTip,, Queue timers stopped
  428.     SetTimer, MatchFound, off
  429.     SetTimer, MatchDodged, off
  430.   } else
  431.   { IfWinExist, ahk_class ApolloRuntimeContentWindow
  432.       WinActivate, ahk_class ApolloRuntimeContentWindow
  433.     TrayTip, Waiting on Queue...., Please Enter a Queue,,17
  434.     SetTimer, MatchFound, 500
  435.     SetTimer, MatchDodged, 500
  436.   }
  437.   MyToggle:=!MyToggle
  438.   Return
  439.  
  440. MatchFound:
  441.  CoordMode,Mouse,Screen
  442.   CoordMode,Pixel,Screen
  443.   ImageSearch,,, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, Images\Found.png
  444.   if not ErrorLevel
  445.   {
  446.     MouseGetPos,mousex, mousey, activewindow
  447.     WinActivate, ahk_class ApolloRuntimeContentWindow
  448.     WinGetPos,,, w, h, A
  449.     CoordMode,Mouse,Window
  450.     CoordMode,Pixel,Window
  451.     Sleep, 300
  452.     MouseClick,left, % Round(589 / (1280 / w)), % Round(445 / (800 / h))
  453.     WinActivate, ahk_id %activewindow%
  454.     CoordMode,Mouse,Screen
  455.     CoordMode,Pixel,Screen
  456.     MouseMove, %mousex%, %mousey%
  457.     SetTimer, MatchFound, Off
  458.   } Return
  459.  
  460.  
  461. MatchDodged:
  462.  CoordMode,Mouse,Screen
  463.   CoordMode,Pixel,Screen
  464.   ImageSearch,,, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, Images\NotFound.png
  465.   if ErrorLevel
  466.     Goto, MatchFound
  467.   Else
  468.   { if not ErrorLevel
  469.       Goto, MatchFound
  470.     SetTimer, MatchDodged, Off
  471.   } Return
  472.  
  473. ;===Stuff===========================================================================================
  474. GuiMove()
  475. { global GUIHwnd
  476.   PostMessage, 0xA1, 2,,, % "ahk_id " GUIHwnd
  477. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement