Jump to content

Recommended Posts

Func dg_get_images()
   $x1=0
   $y1=0
   ;MsgBox(0,"start","start")
   do
      $result =  _ImageSearch("C:\Users\Server\Desktop\my project\image.png",1,$x1,$y1,0)
   until $result = 1;
   if $result=1 Then
       MouseMove($x1,$y1,3)
       MouseClick("left", $x1,$y1, 1)
       WinWait("[Title:TightVNC File Transfer]", "", 10)
   EndIf

 this code works when i search the image, but when i change the location of the desktop icon it can't find the desktop icon anymore.   i wanna try image search area. but i don't know how to use it because i cant understand the parameter for the image search area.  please help me how to solve it thank you in advance.

Link to comment
Share on other sites

  • 4 weeks later...

Hi buddy, you can try below code in your project. The code is affected by $tolerance value. You can find the most appropriate parameter value by trial and error method. I set it for 150. You can change the value in 0 to 255 to find your icon on the desktop.

#include <ImageSearch2015.au3>

Local $left = 0
Local $top = 0
Local $right = @DeskTopWidth
Local $bottom = @DeskTopHeight
Local $tolerance = 150
Local $transparency = 0


$file = "C:\Users\Server\Desktop\my project\image.png"
sleep(5000)

while true
    dg_get_images()
    sleep(1000)
Wend

Func dg_get_images()
   $x1=0
   $y1=0

   do
      $result =  _ImageSearchArea($file, 1, $left, $top, $right, $bottom, $x1, $y1, $tolerance, $transparency)
   until $result = 1;

   if $result=1 Then
       MouseMove($x1,$y1,3)
       MouseClick("left", $x1,$y1, 1)
       WinWait("[Title:TightVNC File Transfer]", "", 10)
   EndIf
EndFunc

good work.

Link to comment
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
 Share

×
×
  • Create New...