SvladJelly Posted October 28, 2013 Share Posted October 28, 2013 (edited) Hey guys, I'm working in a program called TVPaint, which uses a non standard windowing environment within the program itself. I have it stretched across two monitors, one to view the content I'm working on in full hd resolution, the other, a Wacom Cintiq that I do my drawing on.. zooming in and out as I go. Problem is, TVPaint's dialog boxes don't all remember their positions. So, if I do something that opens a specific dialog box, it appears always on my monitor #1 not the Cintiq. I have to stop what I'm doing and go look for this dialog box, then resume whatever task I was doing. Breaks my concentration and workflow. Until TVPaint fixes this, I've come up with a few scripts for the five various dialog boxes that I constantly need to move by hand. Currently I do this by just detecting a particular color that shows up in each dialog box, using the pixelsearch command, it then mouses over and drags the window on to the 2nd monitor (cintiq) I have 5 copies of these autoit scripts running in my tray at once. I'd like to merge them, but lack the time to investigate how to do this, being mostly a total non programmer, as I'm working on this big deadline. Can someone help out? I'd be glad to draw you a cartoon in exchange..avatar, something for your website, whatever you like. Firstly, I'd like to merge all five scripts into one. Secondly, I'd like them to turn off when TVPaint loses focus, turn back on when it gains focus. (or pause, unpause) - Autoit messes with Aero on Windows 8, which I can't disable. :-b Third: Can that mouse movement be sped up to near instant, when dragging the window? Thanks in advance for any help! Scripts follow: 1: Animbrush dialog While 1 close() WEnd Func close() $findpixel3 = PixelSearch(1212, 726,1218, 734,"0xA5F700") if IsArray($findpixel3) = True Then MouseMove(1235,678) MouseClickDrag("left", 1235, 678, 3300, 410,0) EndIf EndFunc 2: Close dialog While 1 close() WEnd Func close() $findpixel3 = PixelSearch(1191, 734,1200, 741,"0xA5F700") if IsArray($findpixel3) = True Then MouseMove(1240,669) MouseClickDrag("left", 1240, 669, 3300, 410,1) EndIf EndFunc 3: FX Stack Progress Profile Dialog While 1 progressprofile() WEnd Func progressprofile() $findpixel3 = PixelSearch(215, 274,222, 282,"0xA5F700") if IsArray($findpixel3) = True Then MouseMove(286,220) MouseClickDrag("left", 286, 220, 3300, 410,1) EndIf EndFunc 4: Layer adjust While 1 progressprofile() WEnd Func progressprofile() $findpixel3 = PixelSearch(217, 790,1222, 795,"0xA5F700") if IsArray($findpixel3) = True Then MouseMove(1248,621) MouseClickDrag("left", 1248, 621, 3300, 410,1) EndIf EndFunc 5: Close / Save While 1 progressprofile() WEnd Func progressprofile() $findpixel3 = PixelSearch(1078, 626,1084, 733,"0xA5F700") if IsArray($findpixel3) = True Then MouseMove(1154,677) MouseClickDrag("left", 1154,677, 3300, 410,1) EndIf EndFunc Edited October 28, 2013 by SvladJelly Link to comment Share on other sites More sharing options...
Solution DatMCEyeBall Posted October 28, 2013 Solution Share Posted October 28, 2013 (edited) I can't test it, so here goes: expandcollapse popup$hWnd = WinGetHandle("[CLASS:Window Class]") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Set the window class here (get it from Au3Info) If @error Then MsgBox(16, "", "Window not found, this script will now exit.") Exit EndIf While 1 If WinGetHandle("[active]") = $hWnd Then ;If the active window is the same as the $hWnd variable then we check pixels. #region Animbrush dialog $aiPixelSearch = PixelSearch(1212, 726,1218, 734,"0xA5F700") If IsArray($aiPixelSearch) Then MouseMove(1235, 678, 0) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Mouse moves' 3rd parameter changes speed. MouseClickDrag("left", 1235, 678, 3300, 410, 0) EndIf #endregion Animbrush dialog #region Close dialog $aiPixelSearch = PixelSearch(1191, 734, 1200, 741, "0xA5F700") If IsArray($aiPixelSearch) Then MouseMove(1240, 669, 0) MouseClickDrag("left", 1240, 669, 3300, 410, 0) EndIf #endregion Close dialog #region FX Stack Progress Profile Dialog $aiPixelSearch = PixelSearch(215, 274, 222, 282, "0xA5F700") If IsArray($aiPixelSearch) Then MouseMove(286, 220, 0) MouseClickDrag("left", 286, 220, 3300, 410, 0) EndIf #endregion FX Stack Progress Profile Dialog #region Layer adjust $aiPixelSearch = PixelSearch(217, 790, 1222, 795, "0xA5F700") If IsArray($aiPixelSearch) Then MouseMove(1248, 621, 0) MouseClickDrag("left", 1248, 621, 3300, 410, 0) EndIf #endregion Layer adjust #region Close / Save $aiPixelSearch = PixelSearch(1078, 626, 1084, 733, "0xA5F700") If IsArray($aiPixelSearch) Then MouseMove(1154, 677, 0) MouseClickDrag("left", 1154, 677, 3300, 410, 0) EndIf #endregion Close / Save EndIf Sleep(10) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Sleep to avoid high CPU usage WEnd All you have to do is use the Au3 Window Info tool on the window (drag the finder tool on the window) and paste it's class in the first line: Lets say the class of the window is "Window Class". Then the first line would be: $hWnd = WinGetHandle("[CLASS:Window Class]") Edited October 28, 2013 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
SvladJelly Posted October 28, 2013 Author Share Posted October 28, 2013 AMAZING!! Works perfectly. You just saved me so much time! What can I draw for you? PM me with your request. Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted October 28, 2013 Share Posted October 28, 2013 (edited) Apparently new members can't use the Messaging system. Draw me some kind of colorful thing that has an eyeball or two in it (see my avatar), really I don't know exactly what it should look like, so be creative. Maybe a wallpaper made of eyes, multi-coloured ones (1920x1080). Edited October 28, 2013 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation 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