mttgbsn

Newbie script question

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



  1. Pixelsearch is one of the unsafest methods to auotmate somerthing. Tell the applications name and we will find a better solution.
  2. Use the "< >" -Button for Codetags
  3. Your link is like the script, he makes problems. 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

@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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.