mr-es335 Posted 16 hours ago Posted 16 hours ago (edited) Good day, I hope that all is having a great day thus far? I hope, as always, that I am asking the appropriate questions here? I have the following script which provides the ability to launch and to exit notepad. However, the GUI "appears" sluggish! Here is the script: expandcollapse popup; ----------------------------------------------- #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; ----------------------------------------------- $Form1 = GUICreate("", 95, 45) $Button = GUICtrlCreateButton("Launch Me", 10, 10, 75, 25) GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 $nMsg = GUIGetMsg() ; ----------------- Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button _LaunchTAC() _form2() EndSwitch WEnd ; ----------------------------------------------- Func _LaunchTAC() Local $sSrcAppPath = "C:\Windows\System32\notepad.exe" ; ----------------------------------------------- Run($sSrcAppPath) ; ----------------------------------------------- Sleep(500) ; ----------------- WinMove("[CLASS:Notepad]", "", 150, 250, 250, 250) EndFunc ;==>_LaunchTAC ; ----------------------------------------------- Func _form2() $Form2 = GUICreate("", 95, 45, 215, 340) $Button = GUICtrlCreateButton("Exit Me", 10, 10, 75, 25) ; ----------------- GUISetState(@SW_SHOW) ; ----------------- While 2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button _ExitMe() GUIDelete($Form2) GUISetState(@SW_ENABLE, $Form1) Return EndSwitch WEnd EndFunc ;==>_form2 ; ----------------------------------------------- Func _ExitMe() Local $sAppTitle = "[CLASS:Notepad]" ; ----------------------------------------------- WinClose($sAppTitle) EndFunc ;==>_ExitTac ; ----------------------------------------------- Also, I am not able to execute the first button command a second time! Any ideas|suggestions would be greatly appreciated. Edited 15 hours ago by mr-es335 lizaclarraa 1 mr-es335 Sentinel Music Studios
argumentum Posted 10 hours ago Posted 10 hours ago use #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Don't call every button $Button. lizaclarraa 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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