Jump to content

Recommended Posts

Posted (edited)

Hello,

maybe i am just tired or i did not understand exactly how to use ImageSearch for different pictures, but i tried now a few things with my example script and only the first part is working.

Explaining what i try to do, at work we have a programm running which has three different states, they are visible but sometimes the statuses of the process is not running and to avoid a long time without progress of the programm i searched to get a way to have a better visible notification as existing, so there is grey as work in progress, orange for not running and red for aborted, now when the states are changing i would like to receive a little window that is just telling the actual status.

#include <ImageSearch2015.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

$x1=0
$y1=0


While 1
sleep(100)
$image1 = _ImageSearch("red.png", 1,$x1,$y1,0)
If $image1 = 1 then
SplashTextOn ( "", "RED !" , 100 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "Arial" , 12 , 500 )
         Sleep(1000)
         SplashOff()
sleep(100)
EndIf

$image2 = _ImageSearch("orange.png", 1,$x1,$y1,0)
If $image2 = 1 Then
SplashTextOn ( "", "Orange !" , 100 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "Arial" , 12 , 500 )
         Sleep(1000)
         SplashOff()
sleep(100)
EndIf

$image3 = _ImageSearch("grey.png", 1,$x1,$y1,0)
If $image3 = 1 Then
SplashTextOn ( "", "Grey !" , 100 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "Arial" , 12 , 500 )
         Sleep(1000)
         SplashOff()
EndIf
WEnd

As i said before, part one to receive the state for aborted is working, so i get the splash window for this, but what do i miss for the other two?
I put the While statement in for continuously running as long it is needed when the program is in use, but i believe i missed something.

Edited by Errious
Posted

Can you try re-ordering the script so that the orange is on top?

See if that changes anything.

Also, you could put a consolewrite line in the end of the script with the 3 variables to see what the result is.

Also you could troubleshoot for error, with @error, and check if the orange.png and grey.png are exactly the same as the program.

Is there any change from red.png to the other 2 in terms of size or something?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

It turns out i was to tired...

I forgot to define a tollerance for the images and when the programm runs not in front window it goes a bit darker and this way my script was not working of course...

Now i added 30% tollerance and it is working well.

 

Thank you very much for your response and help approaches!

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
×
×
  • Create New...