All pastes #2055872 Raw Edit

Rift - AutoMailOpner

public text v1 · immutable
#2055872 ·published 2011-05-09 19:36 UTC
rendered paste body
; ****************************************************************************************************************************************************************
; System check
; ****************************************************************************************************************************************************************

#singleinstance force
;#notrayicon

if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME
{
    MsgBox This program requires Windows 2000/XP or later.
    ExitApp
}

; ****************************************************************************************************************************************************************
; Settings
; ****************************************************************************************************************************************************************

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
colordef=959595 ; Standard color for now	

; ****************************************************************************************************************************************************************
; GUI Dev.
; ****************************************************************************************************************************************************************

Main:
gui, 1:color, %colordef%
Gui, 1:Show, x1000 y119 h400 w200, Mail
WinGet Gui_ID, ID, Mail
Gui, 1:Add, Button, x0 y380 w60 h20 , Avslutt
Gui, 1:Add, Button, x60 y380 w60 h20 , Reload
Gui, 1:Add, Button, x0 y0 w200 h50 , Get Mail
Gui, 1:Add, Button, x0 y50 w200 h50 , STOP!
Gui, 1:Add, Button, x0 y100 W200 H25, Set Mouse 1
Gui, 1:Add, Text, x0 y130 w200 h25 +center , Mouse Info: %MouseX%, %MouseY%
Gui, 1:Add, Button, x0 y155 W200 h25, Get Color
Gui, 1:Add, Text, x0 y185 w200 h25 +center , Color Info: %color%

return
;-----

; ****************************************************************************************************************************************************************
; Buttons and keys
; ****************************************************************************************************************************************************************

buttonsetmouse1:
gui, 1:destroy
WinWaitActive, RIFT
sleep 5000
MouseGetPos, MouseX, MouseY
SplashTextOn, 400, 20 , MouseDone, Mouse pos. set %MouseX%, %MouseY%
sleep 2000
SplashTextOff
gosub, Main

return
;-----

buttongetcolor:

gui, 1:destroy
WinWaitActive, RIFT
CoordMode, Pixel
PixelGetColor, color, %MouseX%, %MouseY%
SplashTextOn, 400, 20 , ColorDone, Color Set %color%
sleep 2000
SplashTextOff
gosub, Main

return
;-----

+a::
nextmail:
buttongetmail:
WinWaitActive, RIFT
CoordMode, Pixel
PixelGetColor, newmail, %MouseX%, %MouseY%
If (newmail = color) ;NewMail
{
	MouseMove, %MouseX%, %MouseY%
	sleep 500
	MouseClick, left, %MouseX%, %MouseY%
	sleep 1000
	gosub, getmail
}
else
SplashTextOn, 400, 20 , Done, No more Mail...
sleep 2000
SplashTextOff

MsgBox %MouseX%, %MouseY% %color% %newmail% ;Debug to see if we get variables
return
;-----

buttonreload:
reload
;-----

Pause:: 
Suspend 
Pause,,1

return
;-----

; ****************************************************************************************************************************************************************
; Codes
; ****************************************************************************************************************************************************************

getmail:
CoordMode, Pixel
Pixelgetcolor, getmail, 580, 599

If (getmail = "0x41413F")
{
	MouseMove, 535, 602
	sleep 500
	MouseMove, 534, 601
	sleep 500
	MouseClick, left, , , 2
	sleep 500
	gosub, nextmail
}
Else
Gui, 1:destroy
MsgBox Error @ geting mail Check %getmail%
gosub, Main

return
;-----


; ****************************************************************************************************************************************************************
; ExitApp
; ****************************************************************************************************************************************************************

guiclose:
buttonavslutt:
buttonstop!:
exitapp