Checking for an area of the screen to change then sending a message to a skype group conversation

StackOverflow https://stackoverflow.com/questions/19884491

  •  30-07-2022
  •  | 
  •  

Question

I'm looking for some help creating a bit of code that will look at an area of my screen and then after 60 seconds for it to check if it has changed.

After it has changed I am then trying to send a message over skype to a group of people with a message however the problem i'm having is that I can't change chat easily using ControlCommand, MouseMove, MouseClick, ControlSend...etc

I even tried MouseClickPlus to click when minimised but that didn't work at all.

The coordinates in question for the box that I'm trying to look at are: 86, 109, 280, 109

If anyone knows ways to do this I would greatly appreciate the help.

Was it helpful?

Solution

Looks like you need to use the Skype UDF and PixelChecksum or maybe even ImageSearch with ImageCapture

I would say the best way to check if the said area changes is using PixelChecksum which can be used like below.

PixelChecksum Code Example 1

Local $GetAreaChecksumOne = PixelChecksum(86, 109, 280, 109)
Sleep(60000)
Local $GetAreaChecksumTwo = PixelChecksum(86, 109, 280, 109)
While $GetAreaChecksumOne <> $GetAreaChecksumTwo
    $GetAreaChecksumTwo = PixelChecksum(86, 109, 280, 109)
    Sleep(1000)
    ConsoleWrite("Match not found")
WEnd

Or a more normal way of doing it would be:

PixelChecksum Code Example 2

Local $GetAreaChecksumOne = PixelChecksum(86, 109, 280, 109)
While $GetAreaChecksumOne = PixelChecksum(86, 109, 280, 109)
    Sleep(100)
WEnd

Refrence Link: PixelChecksum

To send a skype message you'll need the Skype UDF if you want to send messages to a favourite chat in Skype.

Skype Code Example

#include <Skype.au3>
Local $sTopic = "Bookmarked (favourited) chat name here"
Local $aBookMarkedChat = _Skype_ChatGetBookmarked(), $oChattmp = 0
For $i = 0 To UBound($aBookMarkedChat) -1
    $oChattmp = $aBookMarkedChat[$i]
    If _Skype_ChatGetTopic($oChattmp) = $sTopic Then
        _Skype_ChatSendMessage($oChattmp, "Message here")
    EndIf
Next

If you want to go down an imagecapture and imagesearch route then use something similar to below, however again you'll need the ImageSearch UDF

ScreenCapture and ImageSearch Code Example

#include <ImageSearch.au3>
#include <ScreenCapture.au3>
Local $XCoords = 0
Local $YCoords = 0
_ScreenCapture_Capture(@DesktopDir & "Compare.png", 86, 109, 280, 109)
Sleep(60000)
$Compare = _ImageSearch(@DesktopDir & "Compare.png", 1, $XCoords, $YCoords, 5)
While $Compare = 0
    $Compare = _ImageSearch(@DesktopDir & "Compare.png", 1, $XCoords, $YCoords, 5)
Sleep(1000)
WEnd
FileDelete(@DesktopDir & "Compare.png")

If you want to make a more througah ImageSearch then use ImageSearchArea (faster and for what you need it's better)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top