Jump to content

Key is pressed when pixel color "true"


Recommended Posts

Hi guys. I'm total noob at all this scripting, so sorry if my question is stupid.

I want to make script that constantly tracks certain color at (x,y), and sends "a", "v","o" and "t" if certain conditions are met.

Better explanation:

color 1 appears at x,y

check if color 2 appears at x2, y2

if true then send "a"

else (there's no color 2) send "v"

same is performed for "o" and "t" (but with another coordinates) at the same time

I've found this little script but it seems that I did something wrong or it's just broken.

While 1

$a = PixelSearch( 428, 428, 622, 622, 0xe8e7e7 )

$v = PixelSearch( 563, 563, 772, 772, 0x660000 )

if $a = true then

send("a")

endif

if $v = true then

send("v")

endif

WEnd

Can somebody help me with this?

P.S. Sorry for my english, I know I'm terrible.

Link to comment
Share on other sites

Hi

Welcome to the autoit forum :)

What do you need this script for ?

Hi ^_^ Thanks

Ummm I don't sure how this is translated to english correctly. "Университетский проект для автоматизации геоинформационных систем"

Edited by futahito
Link to comment
Share on other sites

Let's say you're not lying.

When you don't know how a function works, read the help file for this last.

You will learn that the PixelSearch function returns an array if the color is found.

$a = PixelSearch(...

If IsArray($a) Then
;found
...

Br, FireFox.

x) Are there a lot of newcomers-liars on this forum?

-_ how did I missed that? I'm stupid...

So, basically, array $a is created when pixel is found, but will it work after one "found" operation? After first check array will be present in all next checks, would it?

Link to comment
Share on other sites

  • Moderators

futahito,

x) Are there a lot of newcomers-liars on this forum?

Unfortunately, when they ask about PixelSearch the answer is often: Yes. :(

Each call to PixelSearch returns an array - you would need to check it each it each time. ;)

Do you realise there are better ways of automating GUIs that searching for pixels? Have you tried any of them? Why not post a screenshot of the GUI you are trying to automate with some explanation of what exactly you are trying to do so that we can see if we can get you on a better path. :)

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

futahito,

Unfortunately, when they ask about PixelSearch the answer is often: Yes. :(

Each call to PixelSearch returns an array - you would need to check it each it each time. ;)

Do you realise there are better ways of automating GUIs that searching for pixels? Have you tried any of them? Why not post a screenshot of the GUI you are trying to automate with some explanation of what exactly you are trying to do so that we can see if we can get you on a better path. :)

M23

Oh, of course. I want to use it with GIS to make automatic notificathion, when certain map area combinations are present on the working space of program, while program is constantly updating.

Posted Image

We were studying Pascal but there's no function of tracking pixel colors.

Edited by futahito
Link to comment
Share on other sites

  • Moderators

futahito,

certain map area combinations are present

And how do you determine this? Which pixels are you currently checking? Is there anything else on the GUI (preferably in a fixed location if those pixels are not) that could act as a trigger ? :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

Simple question: is there any chance the GIS you are using is based on Spatialite? If it is, maybe you can find a better way by querying the SQLite database the GIS is based on.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

futahito,

And how do you determine this? Which pixels are you currently checking? Is there anything else on the GUI (preferably in a fixed location if those pixels are not) that could act as a trigger ? :huh:

M23

Umm I don't clearly understand what you are asking. I want Autoit to check changes certain spots of the map, if you're asking about this.

Simple question: is there any chance the GIS you are using is based on Spatialite? If it is, maybe you can find a better way by querying the SQLite database the GIS is based on.

I should ask my teacher, he gave me it. Actually, working with SQL db will be easier, i think. Thanks for advice^_^
Link to comment
Share on other sites

  • Moderators

futahito,

I want Autoit to check changes certain spots of the map

I guessed that much from your original question. :D

I was asking if anything else on the GUI changed when the condiditons for which you are looking exist as it might be easier to detect that rather then looking for pixels on the map itself. But if there are none, we will have to deal with the map. :)

Please explain exactly what it is you are looking for on that map. Where are these specific pixels that you wish to check? :huh:

M23

P.S. And in future please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - we know what we wrote and it just pads the thread unneccessarily. ;)

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

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

  • Recently Browsing   0 members

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