Thomas56

PictureSearch and post request

5 posts in this topic

#1 ·  Posted

Hi all,

I´am new to Autoit and I have no programming skills. 


What I want to do is I have to check the Screen for an alarm message (Picture) and if this appears I have to send a post request. 


What I have till now is a Script which can find this Picture with PictureSearch and make the post request to a Server. This works fine. I have copied the needed parts from different sample Scripts all over the web. Now the script search for the Picture, send the request and stops.


What I want to change is that the script keeps running and make the request, after a sleep again for three times. Then it shoulg go back to the top and search again for the picture. The script should keep running until it is stopped manualy.

Would be great if someone could help.

Thanks

Alarm.png

Share this post


Link to post
Share on other sites



#2 ·  Posted

Please post the code as tekst in a codebox using the <> option available in the top row of the message editor so we can cut&paste it to assist.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hi Jos,

thank you for your replay. here the Code:

#include <ImageSearch2015.au3>
#include "WinHttp.au3"

$x1 = 0
$y1 = 0
$picture = "C:\alarm.PNG"


Do
    $result = _ImageSearch ($picture,1,$x1,$y1,100,0)
    ;_ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $transparency = 0)

    ConsoleWrite($result)
until $result = 1;
if $result=1 Then




Global $MD5 = HttpPost("https://www.pushsafer.com/api?k=xxxxxxxxxxxxxx&d=xxxxxx&s=xx&v=x&m=%0A")
MsgBox(64, "MD5", $MD5)

Else
    MsgBox(0,"MSG","End")
EndIf

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

Wouldn't it be as simple as this?:

#include <ImageSearch2015.au3>
#include "WinHttp.au3"

$x1 = 0
$y1 = 0
$picture = "C:\alarm.PNG"

While 1
    $result = _ImageSearch($picture, 1, $x1, $y1, 100, 0)
    ;_ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $transparency = 0)
    ConsoleWrite($result)
    If $result = 1 Then
        Global $MD5 = HttpPost("https://www.pushsafer.com/api?k=xxxxxxxxxxxxxx&d=xxxxxx&s=xx&v=x&m=%0A")
        MsgBox(64, "MD5", $MD5)
    EndIf
WEnd

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted

Hi Jos,

yes, for a true master it is easy. For me it is just :sweating:. Thank you very much. Now I can go on to step 2 of my Project. On a System start I have to start the Monitoring Software with username and password and for sure this script. I will try to find a way by myself. But is nice to have such helpful People.

Thanks again,

Thomas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now