PartyPooper Posted November 24, 2005 Share Posted November 24, 2005 I'm using the following code to screen cap the foreground window but for some reason I can't seem to hide the Save As dialog box using the WinSetSate function. Anyone have a better way of doing this? Func OnScreenCap() GUISetCursor(1, 1) WinActivate($WindowTitle) Send("!{PRINTSCREEN}") Run("mspaint.exe", "", @SW_HIDE) WinWait("untitled - Paint") Sleep(500) ControlSend("untitled - Paint", "", "", "^v") Sleep(500) ControlSend("untitled - Paint", "", "", "^s") WinWait("Save As", "") WinSetState("Save As", "", @SW_HIDE) Sleep(500) ControlSend("Save As", "", "Edit1", @ScriptDir & "\Screenshots\" & @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & "-" & @SEC & ".bmp") ControlClick("Save As", "", "Button2") opt("WinTitleMatchMode", 2) WinClose(" - Paint") GUISetCursor(2, 0) EndFunc Thanks. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 24, 2005 Share Posted November 24, 2005 maybe you should try winsettrans("Save As", "", 0) to make your window invisible worked as i tried it out my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
PartyPooper Posted November 24, 2005 Author Share Posted November 24, 2005 Thanks Nuffilein805. It worked here too so I'll use it. Still would've liked to know why WinSetState didn't work. Maybe it has something to do with child windows? Link to comment Share on other sites More sharing options...
LxP Posted November 24, 2005 Share Posted November 24, 2005 It worked here too so I'll use it. Still would've liked to know why WinSetState didn't work. Maybe it has something to do with child windows?Odd... I use it on file dialogues without any trouble; in fact I tried that part of your code with Paint and all was well. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 24, 2005 Share Posted November 24, 2005 does his code work at your pc? it doesn't work on my pc either that's the reason i made the invisible-stuff my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
LxP Posted November 24, 2005 Share Posted November 24, 2005 does his code work at your pc?Yep, it works without any major problems. My Paint toolbars are detached from the main window so they appear while the Paint window is hidden, but I don't think that's important enough to accommodate. Link to comment Share on other sites More sharing options...
PartyPooper Posted November 24, 2005 Author Share Posted November 24, 2005 I've also had to modify the code slightly by adding Opt("WinTitleMatchMode", 1) because my main gui window kept disappearing (only left with a task bar icon) once the routine returned if I left Opt("WinTitleMatchMode", 2) active. My code now works fine with:Opt("WinTitleMatchMode", 2) WinClose(" - Paint") Opt("WinTitleMatchMode", 1)Took me hours to track it down because I thought the problem was in another part of my code. Not sure if this is a bug or how things are supposed to work. 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