momar33 Posted August 30, 2007 Share Posted August 30, 2007 Is there a way to hide a window before it opens? Right now i do a WinSetState() after i open the application, but that shows the window for a half second before hiding. I would like for it the application that i am opening to never be seen. Thanks Link to comment Share on other sites More sharing options...
weaponx Posted August 30, 2007 Share Posted August 30, 2007 @SW_HIDE?? Link to comment Share on other sites More sharing options...
mrbloody369 Posted August 30, 2007 Share Posted August 30, 2007 Is there a way to hide a window before it opens? Right now i do a WinSetState() after i open the application, but that shows the window for a half second before hiding. I would like for it the application that i am opening to never be seen. ThanksHere is an example of hideing the window then opening it. ShellExecute("vlc", "", "C:\Documents and Settings\user\My Documents\vlc-0.8.6b-win32\vlc-0.8.6b\","", @SW_HIDE) while Not WinExists("VLC media player") Sleep(500) WEnd WinMove("VLC media player","", 0 , 0) WinSetState("VLC media player", "", @SW_SHOW) Sleep(30) EndIf Favorite Quotes"If you apply your mind you can create any thing you can dream of" "Any thing can get done by simply click of a button" Link to comment Share on other sites More sharing options...
momar33 Posted August 30, 2007 Author Share Posted August 30, 2007 Here is an example of hideing the window then opening it. ShellExecute("vlc", "", "C:\Documents and Settings\user\My Documents\vlc-0.8.6b-win32\vlc-0.8.6b\","", @SW_HIDE) while Not WinExists("VLC media player") Sleep(500) WEnd WinMove("VLC media player","", 0 , 0) WinSetState("VLC media player", "", @SW_SHOW) Sleep(30) EndIf I tried this with calc.exe and it did nothing. I have also tried using the @SW_HIDE with Run(), it doesn't seem to be working. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 30, 2007 Developers Share Posted August 30, 2007 (edited) I tried this with calc.exe and it did nothing.I have also tried using the @SW_HIDE with Run(), it doesn't seem to be working.This all depends on the actual application and is not something AutoIt3 can influence.If the application decides to show a window initially then there is not much you can do other then to wait and hide it. Edited August 30, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ssubirias3 Posted August 30, 2007 Share Posted August 30, 2007 Is there a way to hide a window before it opens? Right now i do a WinSetState() after i open the application, but that shows the window for a half second before hiding.I too have been looking for a smoother and flicker free way of launching a hidden or minimized app. Even when @SW flags words with an app in the Run() command there can still be that split second flicker you're describing. Based on JdeB's answer it looks like we might be out of luck . I have also tried using the @SW_HIDE with Run(), it doesn't seem to be working.Yeah I played around for a bit to see if any of the @SW flags would work with calc.exe but came up empty handed. Like JdeB said with some apps we have to wait and hide. Notepad unlike calc.exe works fine with @SW_HIDE in the Run() command. Here's the quick and crude code I played with if you're interested. expandcollapse popupOpt("WinTitleMatchMode", 4) Run("calc.exe", "", @SW_MINIMIZE) ;; <-- doesn't work either Sleep(1500) WinSetState("Calculator", "", @SW_HIDE) Sleep(1500) WinSetState("", "", @SW_SHOW) Sleep(1500) WinSetState("", "", @SW_MAXIMIZE) ;; <-- works despite not being an available command w/in calc.exe Sleep(1500) WinSetState("", "", @SW_RESTORE) ;; <-- works despite not being an available command w/in calc.exe Sleep(1500) WinSetState("", "", @SW_MINIMIZE) Sleep(1500) WinSetState("", "", @SW_RESTORE) Sleep(1500) WinClose("", "") Sleep(1500) MsgBox(0, "Up Next...", "Notepad Demonstration", 2) Run("notepad.exe", "", @SW_HIDE) Sleep(100) ControlSetText("[Class:Notepad]", "", "[ClassNN:Edit1]", "abcdefg") MsgBox(0, "Sent Text", '"abcdefg" to hidden notepad window', 3) WinSetState("Untitled - Notepad", "", @SW_SHOW) Sleep(1500) WinSetState("", "", @SW_MAXIMIZE) Sleep(1500) WinSetState("", "", @SW_RESTORE) Sleep(1500) WinSetState("", "", @SW_MINIMIZE) Sleep(1500) WinSetState("", "", @SW_RESTORE) Sleep(1500) WinClose("", "") Sleep(1500) MsgBox(0, "Finished", "Thanks for playing!", 5) 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