I am trying to send myself an email when detecting when any friends come online on FIBS backgammon server. (Their name comes up with a red-dish 'On-Line' next to it)
The client I am using is javafibs. I have attached a screenshot of what my screen looks like for testing purposes. But if the attached is too small to see, I also uploaded a larger version to imgur
http://i.imgur.com/JLhGN0q.png
My amateur attempt is below.
I can't get it to work. The ahk script seems to do nothing at all
Please can someone tell me what I am doing wrong? (I know I may need to fine tune the pixelsearch coordinates but I don't think this is the major problem). The code is patched together and I think it has bugs in the way I am using the borrowed code.
Also can I set it to only pixelscan (check for friends who are online) once every 10-15 minutes or so to save CPU power?
I can see this type of 'screenscan' triggers email notification script being *really* useful for a lot of other applications / situations if I can get help to make it work
![Rainbows! Rainbows, Everywhere! :rainbow:](./images/smilies/rainbow_sm.png)
Your help is much appreciated.. Cheers!
sebalotek
Code: Select all
^q::
loop
; for testing out colours
; WHITE IS 0xFFFFFF
; online (reddish) is 0x7800D2
; black is 0x000000
{
PixelSearch,,, 1400, 275, 1435, 500, 0x7800D2, 3, RGB ; look for reddish text
if ErrorLevel
{
MsgBox %ErrorLevel% ; temp line to see if there is an error
continue
}
else
{
sendMail("myusername@gmail.com","my google password","myusername@gmail.com","An opponent is online to on FIBS","This is the email body. Git busy Homeboy!!! Return keys must happen inline.`n`nUse the new line for that.","C:\fibs.txt")
sendMail(emailToAddress,emailPass,emailFromAddress,emailSubject,emailMessage, fileLocation)
{
mailsendlocation := A_MyDocuments
IfNotExist, %mailsendlocation%\mailsend1.17b14.exe
URLDownloadToFile, https://mailsend.googlecode.com/files/mailsend1.17b14.exe, %mailsendlocation%\mailsend1.17b14.exe
Run, %mailsendlocation%\mailsend1.17b14.exe -to %emailToAddress% -from %emailFromAddress% -ssl -smtp smtp.gmail.com -port 465 -sub "%emailSubject%" -M "%emailMessage%" +cc +bc -q -auth-plain -user "%emailFromAddress%" -pass "%emailPass%" -attach "%fileLocation%",, Hide
}
}
}
return