Jump to content

Recommended Posts

Posted

I'm using the following code to try and right click red pixels, but it doesn't seem to work. I think the error may lie in the pixelsearch parameters, but I am unsure.

HotKeySet ("{DOWN}", "_start")
HotKeySet ("{UP}", "_pause")
HotKeySet ("{END}", "_exit")
Global $go = 0
Func _start()
    $go = 1
EndFunc

Func _pause()
    $go = 0
EndFunc
Func _exit()
    Exit
EndFunc

Func _search()
    $pos = PixelSearch(  599, 113, 648, 160 , 0xFF0000,10)
    If IsArray ($pos) Then
        MouseClick ("right", $pos[0], $pos[1], 1, 1)
    Else
        Sleep(10)
    EndIf
EndFunc

While 1
    If $go = 1 Then
        _search()
    Else
        Sleep(10)
    EndIf
WEnd

 

  • Moderators
Posted

Moved to the appropriate forum.

Moderation Team

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

 

Posted

Hi @lucas_,

4 hours ago, lucas_ said:

I think the error may lie in the pixelsearch parameters, but I am unsure.

Which error? Please show us your output/error.

  • Did you already tested with MouseMove() to see where the right click would be?
  • Please check and try the usage of these two options
    • Opt("MouseCoordMode", 1) ; 1=absolute, 0=relative, 2=client
    • Opt("PixelCoordMode", 1) ; 1=absolute, 0=relative, 2=client
#include-once
#include <Array.au3>

Opt("MouseCoordMode", 1) ; 1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 1) ; 1=absolute, 0=relative, 2=client

HotKeySet ("{DOWN}", "_start")
HotKeySet ("{UP}", "_pause")
HotKeySet ("{END}", "_exit")

Global $go = 0

Func _start()
    $go = 1
EndFunc

Func _pause()
    $go = 0
EndFunc

Func _exit()
    Exit
EndFunc

Func _search()
    $pos = PixelSearch(599, 113, 648, 160, 0xFF0000, 10)
    _ArrayDisplay($pos)

    If IsArray($pos) Then
        MouseMove($pos[0], $pos[1], 30)
        MouseClick("right", $pos[0], $pos[1], 1, 1)
    Else
        Sleep(10)
    EndIf
EndFunc

While 1
    If $go = 1 Then
        _search()
    Else
        Sleep(10)
    EndIf
WEnd

Maybe this already solves your problem?

Best regards
Sven

________________
Stay innovative!

==> AutoIt related: 🔗 Organization AutoIt Community🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet🔗 autoit-webdriver-boilerplate

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

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...