Jump to content

Newbie script question


Recommended Posts

Hello,

New Autoit user who has been crawling the forum. I have been working on a script for a few days and have hit a brick wall.

WinActivate("example window")

$pixel = PixelSearch(762, 458, 771, 466, 0x772B1E, 20)

If IsArray($pixel) = True Then
   WinActivate("other example window")
   MouseClick($MOUSE_CLICK_LEFT, 477, 539, 2)
EndIf

If IsArray($pixel) = False Then
   Sleep(500)
EndIf
 

The intent of my script:

1. to run a pixel search for a color of pixel on a window (very small area, could be 20x20 pixels). (For reference this window would be the "example window" in the script I wrote).

2. If the pixel is found in the designated area to mouse click on a button on another window ("other example window") (or if easier for scripting to send a keystroke to "example window") 

3. If the pixel is not found in the designated area then to run the script over.

Any help is appreciated. Additionally any information regarding how quickly the typical pixelsearch with such a small area occurs would be helpful. I am assuming from what I read on this forum that this is largely processor and CPU dependent.

Problem Script.au3

Edited by mttgbsn
to add the script
Link to comment
Share on other sites

Thanks for the feedback @AutoBert. I was not aware that there was a better way to do this than a pixelsearch.

This is the current script with application names included:

WinActivate("PS4 Remote Play")

$pixel = PixelSearch(762, 458, 771, 466, 0x772B1E, 20)

If IsArray($pixel) = True Then
   WinActivate("MaxAim DI Plugin v4.25")
   MouseClick($MOUSE_CLICK_LEFT, 477, 539, 2)
EndIf

If IsArray($pixel) = False Then
   Sleep(500)
EndIf

Edited by mttgbsn
Link to comment
Share on other sites

  • Developers

@mttgbsn,

Welcome to the AutoIt forum. :)

Unfortunately you appear to have missed the Forum rules on your way in. (there is also a link link in my signature) 
Please read them now particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. :naughty:

See you soon with a legitimate question I hope. :)

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