Pixelsearch for red text and send myself a gmail if detected

Get help with using AutoHotkey and its commands and hotkeys
sebalotek
Posts: 3
Joined: 17 Dec 2014, 06:52

Pixelsearch for red text and send myself a gmail if detected

17 Dec 2014, 07:15

Hi,

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 :rainbow:

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("[email protected]","my google password","[email protected]","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
Attachments
2014-12-17 04_00_20-JavaFIBS 2001 - sebalotek - pixelsearch 800x471.png
Explanatory screenshot
johnny256ahk
Posts: 24
Joined: 04 Dec 2014, 07:47

Re: Pixelsearch for red text and send myself a gmail if dete

18 Dec 2014, 05:13

Can you clarify, does the pixel match part work but not the email, or the other way around? Testing you are detecting the other player logging in before even trying the email part would make most sense.

Neat idea by the way.
sebalotek
Posts: 3
Joined: 17 Dec 2014, 06:52

Re: Pixelsearch for red text and send myself a gmail if dete

22 Jun 2017, 07:05

johnny256ahk wrote:Can you clarify, does the pixel match part work but not the email, or the other way around? Testing you are detecting the other player logging in before even trying the email part would make most sense.

Neat idea by the way.
Hi johnny256,

Sorry I did not reply to you all those years ago. I quickly got frustrated with my beginners attempt to make a script and did not check back here for answers.
So THANK YOU for taking the time to respond anyways.

In a conclusion, 3 years down the line, I managed to get together a (better) solution using AHK+Pushbutton for screenscraping+auto-notifications to my Android devices- it's very powerful!!

So, thanks to jNizM and Pulover's Macro Creator

https://autohotkey.com/boards/viewtopic.php?f=7&t=4842

http://www.macrocreator.com

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], songdg and 43 guests