shadowbladex Posted September 14, 2008 Share Posted September 14, 2008 Hi, i am new to autoit and love it so far. But im stuck with a little project im working on. I want to make a script that checks a pixel color and if it finds it, it will beep, but when it can't find it, it does nothing. I want it to continuously do this until i close or pause it. What i'v gotten so far: Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{END}", "Terminate") HotKeySet("{f10}", "Start") While 1 Sleep(100) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Paused',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func Start() WinWaitActive("THEPROGRAM") WinMove ( "THEPROGRAM", "", 144, 1, 992, 768 ) $Pixel = PixelSearch( 989, 62, 1098, 171, 0xA37C02 ) If Not @error Then Beep(500, 500) Else Not EndIf EndFunc The parts i cant figure out is how to loop the searching and beeping. Also/But i need it to beep when it finds the pixel then stop for like 10 secs then beep again and do this untill the pixel is gone. Help is GREATLY appreciated! Link to comment Share on other sites More sharing options...
martin Posted September 14, 2008 Share Posted September 14, 2008 (edited) Hi, i am new to autoit and love it so far. But im stuck with a little project im working on. I want to make a script that checks a pixel color and if it finds it, it will beep, but when it can't find it, it does nothing. I want it to continuously do this until i close or pause it. What i'v gotten so far: Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{END}", "Terminate") HotKeySet("{f10}", "Start") While 1 Sleep(100) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Paused',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func Start() WinWaitActive("THEPROGRAM") WinMove ( "THEPROGRAM", "", 144, 1, 992, 768 ) $Pixel = PixelSearch( 989, 62, 1098, 171, 0xA37C02 ) If Not @error Then Beep(500, 500) Else Not EndIf EndFunc The parts i cant figure out is how to loop the searching and beeping. Also/But i need it to beep when it finds the pixel then stop for like 10 secs then beep again and do this untill the pixel is gone. Help is GREATLY appreciated! I think this would do it if I understand what you want. Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{END}", "Terminate") HotKeySet("{f10}", "Start") While 1 Sleep(100) WEnd Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Paused', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Func Start() WinWaitActive("THEPROGRAM") WinMove("THEPROGRAM", "", 144, 1, 992, 768) While 1 $Pixel = PixelSearch(989, 62, 1098, 171, 0xA37C02) If Not @error Then Beep(500, 500) Sleep(500) EndIf WEnd EndFunc ;==>Start EDIT:Oh, I didn't notice at first. Welcome to the AutoIt forums >_< Edited September 14, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
shadowbladex Posted September 14, 2008 Author Share Posted September 14, 2008 (edited) Oh wow, that is exactly what i was looking for. You are a legend. Thank you so much martin! One other thing, i just realized i need it to be able to find two different pixel colors. What would i have to do to make it be able to look for either of the colors and still do the same thing? Edited September 14, 2008 by shadowbladex Link to comment Share on other sites More sharing options...
shadowbladex Posted September 14, 2008 Author Share Posted September 14, 2008 Oh wow, that is exactly what i was looking for. >_< You are a legend. Thank you so much martin!One other thing, i just realized i need it to be able to find two different pixel colors.What would i have to do to make it be able to look for either of the colors and still do the same thing?Never mind. I figured it out.Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now