botanic Posted December 30, 2009 Share Posted December 30, 2009 (edited) I want to kill svn.exe gracefully when a button is clicked however ControlSend("C:\Program Files (x86)\Subversion\bin\svn.exe","",$foo,"^c") does not seem to work since the window is hidden. Anyone have any ideas? Here is the code: expandcollapse popup#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=MattL.ico #AutoIt3Wrapper_outfile=updatesvn.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Example1() ; example 1 Func Example1() Local $msg , $drive, $gui GUICreate("Ubiquity USB Update Tool",160,115) ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box $Button_1 = GUICtrlCreateButton("Install Subversion", 5, 5,150,50) $Button_2 = GUICtrlCreateButton("Update USB", 5, 60,150,50) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 FileInstall("C:\development\USB\SetupUSB\setup.msi",@TempDir&"\setup.msi") ShellExecuteWait(@TempDir&"\setup.msi") FileDelete(@TempDir&"\setup.msi") Case $msg = $Button_2 $drive = "NULL" if (DriveGetLabel("A:\") = "BOOTUSB") then $drive = "A:\" if (DriveGetLabel("B:\") = "BOOTUSB") then $drive = "B:\" if (DriveGetLabel("C:\") = "BOOTUSB") then $drive = "C:\" if (DriveGetLabel("D:\") = "BOOTUSB") then $drive = "D:\" if (DriveGetLabel("E:\") = "BOOTUSB") then $drive = "E:\" if (DriveGetLabel("F:\") = "BOOTUSB") then $drive = "F:\" if (DriveGetLabel("G:\") = "BOOTUSB") then $drive = "G:\" if (DriveGetLabel("H:\") = "BOOTUSB") then $drive = "H:\" if (DriveGetLabel("I:\") = "BOOTUSB") then $drive = "I:\" if (DriveGetLabel("J:\") = "BOOTUSB") then $drive = "J:\" if (DriveGetLabel("K:\") = "BOOTUSB") then $drive = "K:\" if (DriveGetLabel("L:\") = "BOOTUSB") then $drive = "L:\" if (DriveGetLabel("M:\") = "BOOTUSB") then $drive = "M:\" if (DriveGetLabel("N:\") = "BOOTUSB") then $drive = "N:\" if (DriveGetLabel("O:\") = "BOOTUSB") then $drive = "O:\" if (DriveGetLabel("P:\") = "BOOTUSB") then $drive = "P:\" if (DriveGetLabel("Q:\") = "BOOTUSB") then $drive = "Q:\" if (DriveGetLabel("R:\") = "BOOTUSB") then $drive = "R:\" if (DriveGetLabel("S:\") = "BOOTUSB") then $drive = "S:\" if (DriveGetLabel("T:\") = "BOOTUSB") then $drive = "T:\" if (DriveGetLabel("U:\") = "BOOTUSB") then $drive = "U:\" if (DriveGetLabel("V:\") = "BOOTUSB") then $drive = "V:\" if (DriveGetLabel("W:\") = "BOOTUSB") then $drive = "W:\" if (DriveGetLabel("X:\") = "BOOTUSB") then $drive = "X:\" if (DriveGetLabel("Y:\") = "BOOTUSB") then $drive = "Y:\" if (DriveGetLabel("Z:\") = "BOOTUSB") then $drive = "Z:\" ;"C:\Program Files (x86)\Subversion\bin\svn.exe" checkout= --username=asdf --password=xsd http://216.6.227.163/repos/mytestproj C:\SVN if $drive <> "NULL" Then if FileExists(@HomeDrive &"\Program Files (x86)\Subversion\bin\svn.exe") = True Then $foo = Run("""" & @HomeDrive &"\Program Files (x86)\Subversion\bin\svn.exe"" checkout --username=asdf --password=asdf http://216.6.227.163/repos/mytestproj "&$drive, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $gui = GUICreate("My GUI", 510, 535) ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box $button = GUICtrlCreateButton("Exit", 5,510,50,20) $myedit = GUICtrlCreateEdit("'Running svn.exe'..." & @CRLF, 5, 5, 500, 500, $ES_AUTOVSCROLL + $WS_VSCROLL) ; Run the GUI until the dialog is closed While 1 $gui = GUIGetMsg() $text = StdoutRead($foo) GUICtrlSetData($myedit, $text, 1) $text = StderrRead($foo) GUICtrlSetData($myedit, $text, 1) If $gui = $GUI_EVENT_CLOSE Then ExitLoop if $gui = $button Then ControlSend("C:\Program Files (x86)\Subversion\bin\svn.exe","",$foo,"^c") GUICtrlSetData($myedit, "Exiting SVN.exe please wait...", 1) ProcessWaitClose($foo) ExitLoop EndIf WEnd GUIDelete() ElseIf FileExists("""" & @HomeDrive &"\Program Files\Subversion\bin\svn.exe") = True then $foo = Run("""" & @HomeDrive &"\Program Files (\Subversion\bin\svn.exe"" checkout --username=asdf --password=asdf http://216.6.227.163/repos/mytestproj "&$drive, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $gui = GUICreate("My GUI", 510, 510) ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box $myedit = GUICtrlCreateEdit("'Running svn.exe'..." & @CRLF, 5, 5, 500, 500, $ES_AUTOVSCROLL + $WS_VSCROLL) ; Run the GUI until the dialog is closed While 1 $gui = GUIGetMsg() $text = StderrRead($foo) GUICtrlSetData($myedit, $text, 1) If $gui = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Else MsgBox(0,"OPPS!", "Seems you did not install SVN yet, please install svn to the default location.") EndIf EndIf if $drive = "NULL" then MsgBox(0,"OPPS!", "Please insert the USB") EndSelect WEnd GUIDelete() EndFunc ;==>Example1 Edited December 30, 2009 by botanic Link to comment Share on other sites More sharing options...
botanic Posted December 30, 2009 Author Share Posted December 30, 2009 got it StdinWrite ($foo, "^c") Link to comment Share on other sites More sharing options...
botanic Posted December 31, 2009 Author Share Posted December 31, 2009 Actually i just thought it worked it really didnt... any ideas? 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