rainydayprogrammer Posted April 8, 2010 Posted April 8, 2010 I am relatively new to AutoIt. I need to create an application that does the following: (Assume computer is running some sort of application eg.VLC) 1. Open some sort of image. 2. Close VLC in the background. 3. Open another application (eg. Notepad) in the background, without switching away from the foreground image. 4. Once notepad is open, close the foreground image to expose notepad window. This is what I have so far Run($vlcPath[1]&" -f "&$vid1&" --no-video-title-show" ,"", @SW_MAXIMIZE); ;Start a random program Sleep(3000); ShellExecute("Jellyfish.jpg",""); ;In 3sec open some image in front of the movie. Sleep(3000); If ProcessExists("vlc.exe") Then ;If the VLC is running, close the application in the background. ProcessClose("vlc.exe"); EndIf Sleep(3000); Run("notepad.exe",""); ;Run Notepad Sleep(1000); WinActivate("Viewer",""); ;Make image window active Sleep(3000); WinClose("Viewer"); ;Close image to reveal notepad window. The problem with this script is that, I can see notepad open and then go into the background. How can I avoid this? How can I have notepad start and run in the background and only become active when I want it to? Please help!!
tehdon Posted April 8, 2010 Posted April 8, 2010 You can start notepad hidden with ShellExecute("notepad.exe","","","",@SW_HIDE) The following would show it, assuming the Window title hasn't changed since when you opened it WinSetState("Untitled - Notepad","",@SW_SHOW)
Yoriz Posted April 8, 2010 Posted April 8, 2010 when you use run to open notepad set the optional 'show' flag to @SW_HIDE, when you want to show notepad use WinSetState with the flag @SW_SHOW. GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
picea892 Posted April 8, 2010 Posted April 8, 2010 #include <guiconstants.au3> #include <constants.au3> #include <windowsconstants.au3> $hGui1 = GUICreate('Just a Way To End SCript', 300,100) GUISetState() Run("notepad.exe","",@SW_HIDE) WinWait("Untitled","",100) $hw1 = WinGetHandle("Untitled") $iRet = DllCall("User32.dll", "int", "SetWindowPos", "Hwnd", $hw1,"Hwnd", $HWND_BOTTOM, _ "int", 100, "int", 300, "int", 300, "int", 300, "uint", $SWP_NOACTIVATE + $SWP_SHOWWINDOW + $SWP_NOMOVE) While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit EndIf WEnd
rainydayprogrammer Posted April 8, 2010 Author Posted April 8, 2010 Thanks everyone! That was very helpful!
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