Jump to content

Alot of the same images , only 1 need to be clicked .


Recommended Posts

Hello i have a problem  .

I am working on the script 

Which need to find an image on the screen and Right click it .

Problem is that the image which needs to be clicked is the same as the others 75 

Process need to be repeated until there are no more those images on the screen

The other part of the code is using images from the folded and click 2 times . 

So its like this 

Image found > right click , new image >left click > new image left click . IS there a way so the first image will be clicked , now script only goes from image to image right clicking all the time . 

 

And can iput smth like this ? >>>

If _ImageSearchArea(@WorkingDir & "\Images\5.png" & "\Images\2.png" & "\Images\4.png"  , 1, 0, 150, @DesktopWidth, @DesktopHeight, $imageX, $imageY, 0) = 1 Then
$image = $imageList[1] ;First image in file dont use 1 number

;This will search the entire screen for the image
If _ImageSearchArea(@WorkingDir & "\Images\5.png" , 1, 0, 150, @DesktopWidth, @DesktopHeight, $imageX, $imageY, 0) = 1 Then
    ;------------------
    MouseMove($imageX, $imageY, 0)
    Sleep(100) ;A small amount of time for the mouse to move to the image
    MouseClick("Right")
EndIf


$imageCount = 2
While $imageCount <= (UBound($imageList) - 1) ;will continue until there are no more images in the array
    $image = $imageList[$imageCount]
    While _ImageSearchArea(@WorkingDir & "\Images\" & $image, 1, 0, 150, @DesktopWidth, @DesktopHeight, $imageX, $imageY, 0) = 1
        MouseMove($imageX, $imageY, 0)
        Sleep(300)
        MouseClick("Left")
    WEnd
    $imageCount = $imageCount + 1
WEnd
Link to comment
Share on other sites

  • Moderators

What exactly are you trying to automate? I can almost guarantee there is a better way than using ImageSearch, especially if you have so many of the same type of images.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Imagesearch is the must , because in the first part there will be around 60 types of images which will have own duplicates. So its need to find it then click it with right button so the new window will apear to delete it and click confirm 

Link to comment
Share on other sites

  • Moderators

Driveskull,

Please do not bump your own threads within 24 hours. :naughty:

Remember that this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. Although the problem might be urgent to you, it is not to anyone else. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Please provide a screenshot of what you see on your screen so we can see what you are dealing with. No shot of one item, but THE ENTIRE SCREEN. This is easily done by using the ctrl key and pressing print screen. This copies what is on your screen to the clipboard. You then paste it to paint and save it. Now with that saved file upload it here so we can see what you are dealing with. We do not need another worded post explaining your problem we need to SEE what you want. Got it?

Link to comment
Share on other sites

  • Moderators

Driveskull,

Pretty short days where you are - how about sticking to the standard 24hr one that everyone else uses. :naughty:

And I echo MBALZESHARI's comment - please let us see a screenshot. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Driveskull,

And what is the purpose of all this? Why do you need to click these images? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I am learning how image search works , when there are alot of different images there are no problems,  but when images are the same imageserach not performing functions i want . I want to learn how to make it work , but till now i dont have any ideas . 

Link to comment
Share on other sites

Use it for reference for future work , repair the script above , use it for sprite copying automate it so it dont take so much time to gather graphic for some custom build flash pages ?

I dont know why you are so suspicious i dont break any rules with asking for help with my problem yes ? 

Link to comment
Share on other sites

include <ImageSearch.au3>
#include <File.au3>
#include <Misc.au3>


AdlibRegister("_MyExitFunc", 35000) ;40sec
HotKeySet("{ESC}", "Terminate")
;Creates an Array with all the file names in your image folder
Dim $imageList = _FileListToArray(@WorkingDir & "\Images1") ;Change name to folder that holds your images.
Dim $imageList = _FileListToArray(@WorkingDir & "\Images2")
;---------

Dim $imageName
Dim $imageX
Dim $imageY
Dim $imageCount

While 1
$image = $imageList
$image = _ImageSearchArea(@WorkingDir & "\Images1\" & $image ,1, 0, 150, @DesktopWidth, @DesktopHeight, $imageX, $imageY, 0) = 1
If $image=1 Then
MouseMove($imageX, $imageY, 0)
MouseClick("Right")
sleep(50)
$image1=0
EndIf

$image = _ImageSearchArea(@WorkingDir & "\Images2\" & $image ,1, 0, 150, @DesktopWidth, @DesktopHeight, $imageX, $imageY, 0) = 1
If $image=1 Then
MouseMove($imageX, $imageY, 0)
MouseClick("Left")
sleep(50)
$image1=0
EndIf
WEnd




Func Terminate()
    Exit
EndFunc

Func _MyExitFunc()
    Exit ;Terminate the script
EndFunc

Tried another script , but if i put $imagelist[1] it uses only first image in the folder , how to make it it will look for all the items and duplicates ? 

Edited by Driveskull
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...