Jump to content

Pixelsearch a specific Window


Recommended Posts

Hi there,

I'm looking for a workaround to a PixelSearch issue.

I need PixelSearch to work within the confines of a Window.

Why? So I don't have to tailor my code to suit where a window is sitting within a screen, regardless of resolution.

For the basis of this example, lets assume that the window is always 1920x1080 Resolution, but can be located anywhere within a 3440x1440 resolution.

I need the PixelSearch to locate the Window, then search for the color within that 1920x1080 pixel range.

To date I've been using @DesktopWidth and @DesktopHeight, but I want to learn how to tidy this up a bit, in case of running other applications that may interfere with the PixelSearch.

For all I know, this may not even be possible.

Look forward to your help.

Thanks

Link to comment
Share on other sites

Why can't you directly access the window using window title and window text?
Can you post  a screenshot of this window?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

1 hour ago, water said:

Why can't you directly access the window using window title and window text?
Can you post  a screenshot of this window?

Currently I'm using the PixelSearch command within a loop, and using WinActivate.

My issue is that PixelSearch looks either within - 

1. A specified rectangular area based on the pixels of your screen resolution.

   $rectangular = PixelSearch( 599, 113, 648, 160, 0x78B31B)

or

2. The entire desktop. (@DesktopHeight and Width)

   $full_screen_res = PixelSearch( 0,0, @DesktopHeight, @DesktopWidth, 0x78B31B)

BUT

I need a way to isolate the PixelSearch to an active Window, and THEN the specified rectangular area within that window, being 1920x1080 in resolution.

I don't have a screenshot I can share, but the best information I can provide is that the Window will always be a specific resolution (1920x1080), because I'm going to build it that way.

If it simplifies the question, I want PixelSearch to search within a specific Window, not my entire desktop resolution.

I'm confident this is do-able, but I'm far too new to coding to understand exactly what to search for when self-educating.

I know the PixelSearch command itself cannot specify a Window, so I would need to specify this within the loop.

My gut feeling is that this doesn't relate to PixelSearch at all, but instead somehow isolating the script itself to a specific Window?

Edited by Breaker87
Link to comment
Share on other sites

My question is: Why do you need Pixelsearch at all? Autoit provides means to directly access a window wherever it may be located on the screen.
If you could post a screenshot with all private data made unreadable - would help us to help you!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

What you could do, is get the active window coordinates and position, make calculations and pass those to the pixel function.. I think it should be easy enough.

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

Link to comment
Share on other sites

Did you try to read the help at all https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm
It nicely tells you how to search certain areas of the screen
and this tells you nicely how to get your window area https://www.autoitscript.com/autoit3/docs/functions/WinGetPos.htm

 

Check also faq 38 https://www.autoitscript.com/wiki/FAQ#How_can_I_search_an_image_in_another_image.3F

Edited by junkew
Link to comment
Share on other sites

10 hours ago, water said:

My question is: Why do you need Pixelsearch at all? Autoit provides means to directly access a window wherever it may be located on the screen.
If you could post a screenshot with all private data made unreadable - would help us to help you!

I need PixelSearch to determine which color is being displayed at a specific pixel location.

I'm not sure how a screenshot will provide any further insight.

I cannot publicly discuss the IP I am creating the tool for - my apologies.

3 hours ago, junkew said:

Did you try to read the help at all https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm
It nicely tells you how to search certain areas of the screen
and this tells you nicely how to get your window area https://www.autoitscript.com/autoit3/docs/functions/WinGetPos.htm

 

Check also faq 38 https://www.autoitscript.com/wiki/FAQ#How_can_I_search_an_image_in_another_image.3F

I did read the help, and my code works perfectly on the basis I don't move the window to any other position on the screen.

You may be onto something in relation to WinGetPos - but I need to somehow incorporate this into the script in such a way that PixelSearch only looks within that Window Size and Position.

I have attached two screenshots as an example - hopefully this provides further insight.

My question is - Can I isolate my script to the Window itself, and will PixelSearch then search within the Resolution of the Window - NOT my entire screen?

In my example, PixelSearch is looking for Red.

The Working Scenario:

Example 1.png

The Problem Scenario:

example2.png

Edited by Breaker87
Link to comment
Share on other sites

yes, told you how already

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

Link to comment
Share on other sites

  • Moderators

@Breaker87 What App/Website/Game is this for? It seems this question has been asked a couple of times now without a straight answer from you. The more info you provide the more easily we can assist. Otherwise you are asking folks to guess.

"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

5 minutes ago, careca said:

yes, told you how already

Good to know - any chance of an example, or point me in the direction of a help article?

I'm just not sure how to incorporate this into my loop..

Something like..

$WinPos = WinGetPos("Application v1")
$TEST = PixelSearch($WinPos[0] + 250, $WinPos[1] + 125, $WinPos[0] + 255, $WinPos[1] + 129, 0x77B049, 5)

I have no idea.

Link to comment
Share on other sites

Huh.. mod asked question, no more help.

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

Link to comment
Share on other sites

5 minutes ago, careca said:

Huh.. mod asked question, no more help.

Indeed, I ignored it because I feel I have provided enough information and his question was irrelevant to mine.

Probing me on 'what this is for' has no relation to incorporating WinGetPos or into PixelSearch.

I even created screenshot examples.

@careca - you have provided me with enough information to continue my search for information and self-educate - thanks.

Consider my issue resolved.

Link to comment
Share on other sites

2 hours ago, Somerset said:

When a Mod asks a pertinent question, you answer it. Attitude will not help your situation.

Excuse me, but - 

1. I didn't have any attitude, you're the first to add attitude to this thread.

and

2. I'm not obligated to answer anything I don't want to, period - regardless of who asks.

Furthermore, if you don't have anything of value to offer - don't get involved.

Once again, my issue is resolved.

This thread can be closed.

Link to comment
Share on other sites

  • Developers
7 hours ago, Breaker87 said:

Excuse me, but - 

1. I didn't have any attitude, you're the first to add attitude to this thread.

Really?

7 hours ago, Breaker87 said:

and

2. I'm not obligated to answer anything I don't want to, period - regardless of who asks.

Correct, as I don't need to explain why this is locked and no further discussion requires.

*click*

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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