Nemon 0 Posted August 27, 2010 Ok, I have been lightly using auto it for very basic junk. I can get this to work if just use all mouseclick x,y with some sleep commands. I just wanted to try to use pixelsearch to get it done a little more automatic. The script below will select that correct window, but that's about it. All the tooltips work like they should. Just it does not seem that the pixelsearch works at all. Not sure what I am doing wrong. If you could look it over and offer any advice would be great. The old mouseclick script I used for everything else I did is getting old. Thanks in advance!! expandcollapse popup; Declare Variables $media = 0 ; ToolTip displaying function keys Tooltip("HOME = On/Off find media, F10 = Exit", 0, 0) ; List of command keys If Not WinActive("MediaMonkey", "") Then WinActivate("MediaMonkey", "") While WinWaitActive("MediaMonkey", "") HotKeySet("{HOME}", "Find media") HotKeySet("{F10}", "exitNow") WEnd ; Click loop While True If $media = 1 Then $size = WinGetClientSize("MediaMonkey", "") $coord = PixelSearch(0,0, $size[0], $size[1], 0xFECE56) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then MouseClick("left", $coord[0], $coord[1], 1, 0) EndIf EndIf Sleep(500) WEnd ; Functions ; On/Off find media(): Func media() If $media = 0 Then $media = 1 Tooltip("Auto deleting on command (HOME to disable)", 0, 0) Else $media = 0 Tooltip("HOME = On/Off Start deleting, F10 = Exit", 0, 0) EndIf EndFunc ; Exit Func exitNow() Exit EndFunc Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted August 27, 2010 Hi and Welcome to the forums! Wait wait wait. Why are you searching from 0x0 to the windows width and height? What if the window isn't in the upper-left corner? You should fix that. Oh and what is this supposed to be? HotKeySet("{HOME}", "Find media")Functions can't have spaces in them! And remove that loop, it doesn't make any bloody sense at all. Have a good day. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
Nemon 0 Posted August 27, 2010 Hi and Welcome to the forums! Wait wait wait. Why are you searching from 0x0 to the windows width and height? What if the window isn't in the upper-left corner? You should fix that. Oh and what is this supposed to be? HotKeySet("{HOME}", "Find media")Functions can't have spaces in them! And remove that loop, it doesn't make any bloody sense at all. Have a good day. Fixed the space, not sure why I had that in there. As for the 0,0 search to the windows height, in the $size = WinGetClientSize("MediaMonkey", "") $coord = PixelSearch(0,0, $size[0], $size[1], 0xFECE56) I thought that it will automatically grab the entire window called Media Monkey and search it. I was kind of cloudy on getting the correct pixels of the screens. Share this post Link to post Share on other sites
kaotkbliss 146 Posted August 27, 2010 using WinGetPos("MediaMonkey") will give you the windows current x,y coordinates (to use as your pixelsearch start) and the window size (for your search end) 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
Nemon 0 Posted August 27, 2010 Ok I changed it up a bit, took out the loop, put in cords to search. When execute the program the tool tip pops up, it make Media Monky the active window....and that is about it. It just sits there does not move to a color at all. Pixelsearch is kind of hard lol. ; ToolTip displaying function keys Tooltip("F10 = Exit", 0, 0) ; List of command keys If Not WinActive("MedaMonkey", "") Then WinActivate("MediaMonkey", "") HotKeySet("{F10}", "exitNow") $coord = PixelSearch(597, 154, 806, 628, 0x9C885C) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then MouseClick("left", $coord[0], $coord[1], 1, 0) EndIf ; Exit Func exitNow() Exit EndFunc Share this post Link to post Share on other sites
kaotkbliss 146 Posted August 28, 2010 ; ToolTip displaying function keys Tooltip("F10 = Exit", 0, 0) ; List of command keys If Not WinActive("MediaMonkey", "") Then WinActivate("MediaMonkey", "") $medmonkey=WinGetPos("MediaMonkey") HotKeySet("{F10}", "exitNow") $coord = PixelSearch($medmonkey[0], $medmonkey[1], $medmonkey[0]+$medmonkey[3], $medmonkey[1]+$medmonkey[4], 0x9C885C) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then MouseClick("left", $coord[0], $coord[1], 1, 0) EndIf ; Exit Func exitNow() Exit EndFunc No matter where the window is, it will search there and the entire area of the window. 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites