Yobear Posted January 1, 2010 Share Posted January 1, 2010 I'm looking for a script that will play an alarm when there is a certain color recognized at whatever coordinates are marked in a window. I.e. Aim chat window - My buddy sends me a message, lettering is black. Next line buddy sends a red lettered message, my CPU plays an alarm sound. (second lines coordinates would be marked) Is this possible? Sorry if this is a common question - search wasn't helping me out. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 1, 2010 Moderators Share Posted January 1, 2010 Yobear,Welcome to the AutoIt forum. I'm looking for a scriptThat is not exactly how it works here. We want you to have a go at coding something yourself first - we will help out when you run into problems. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. Some pointers to help you get started. Look in the Help file for:WingetPos - this wil help you locate your chat window.PixelGetColor and PixelSearch - they will help you identify when colours change in the window.If...Then - this will let you choose what to do if the colour is or is not foundWhile...WEnd - this will let you wait until you get a colour changeSoundPlay - this will play your alarm soundHave fun! You know where we are if you have problems. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Yobear Posted January 1, 2010 Author Share Posted January 1, 2010 Aye, sorry mate, I realize now my post came off as a "do it for me" type request. I was in fact looking for a few pointers as to where to get started, and you've hit all those for me! Thanks again mate.Yobear,Welcome to the AutoIt forum. That is not exactly how it works here. We want you to have a go at coding something yourself first - we will help out when you run into problems. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. Some pointers to help you get started. Look in the Help file for:WingetPos - this wil help you locate your chat window.PixelGetColor and PixelSearch - they will help you identify when colours change in the window.If...Then - this will let you choose what to do if the colour is or is not foundWhile...WEnd - this will let you wait until you get a colour changeSoundPlay - this will play your alarm soundHave fun! You know where we are if you have problems. M23 Link to comment Share on other sites More sharing options...
Malkey Posted January 2, 2010 Share Posted January 2, 2010 expandcollapse popup; Find a pure red pixel in the range $coord = PixelSearch(0, 0, 820, 800, 0xFF0000) If Not @error Then Alert($coord, "Red, Alert.") ; Find a pure red pixel in the range $coord = PixelSearch(0, 0, 820, 800, 0x000000) If Not @error Then Alert($coord, "Black, Alert.") ; Find a pure green pixel in the range $coord = PixelSearch(0, 0, 820, 800, 0x00FF00, 150) ;<- shade-variation 150 for testing If Not @error Then Alert($coord, "Green, Alert.") ;Ref: http://www.autoitscript.com/forum/index.php?showtopic=106866&view=findpost&p=754100 Func Alert($coord, $ColAlert = "Alert") Local $hGUI, $hLab[5], $temp, $File, $BkGndCol = 0xE0E0E0 $temp = StringReplace($ColAlert & " " & $ColAlert, " ", "+") $File = StringRegExpReplace($ColAlert, "([ .,!])", "") ;Clean up file name. If Not FileExists(@TempDir & "\" & $File & ".mp3") Then _ InetGet("http://translate.google.com/translate_tts?q=" & $temp, _ @TempDir & "\" & $File & ".mp3") If StringInStr($ColAlert, "Red") Then $BkGndCol = 0xFFE0E0 If StringInStr($ColAlert, "Black") Then $BkGndCol = 0xE0E0E0 If StringInStr($ColAlert, "Green") Then $BkGndCol = 0xE0FFE0 $hGUI = GUICreate("Colour Found", 200, 80, -1, -1, 0x80800000, 0x00120100) GUISetBkColor($BkGndCol, $hGUI) $hLab[0] = GUICtrlCreateLabel($ColAlert, 5, 5, 190, 40) GUICtrlSetFont($hLab[0], 22, 600) $hLab[1] = GUICtrlCreateLabel("X and Y are: " & $coord[0] & ", " & $coord[1], 10, 50) MouseMove($coord[0], $coord[1]) GUISetState() SoundPlay(@TempDir & "\" & $File & ".mp3", 1) GUIDelete($hGUI) Return EndFunc ;==>Alert 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