chiners_68 Posted April 13, 2012 Share Posted April 13, 2012 Hi All, ive wrote the following script which uses SoundRecorder in Windows 7. How & what would I add to the script to close, if Sound recorder is closed? Script Function: Sound Recorder v1.2#ce ----------------------------------------------------------------------------#include <GUIConstants.au3>Run(@WindowsDir & "\system32\SoundRecorder.exe", "", @SW_SHOWNORMAL)WinWaitActive("Save As", "")WinSetState("Save As", "", @SW_HIDE)ControlSend("Save As", "", 1001, "\\wi102-st01\e$\test\" & @UserName & " " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & "." & @MIN & "." & @SEC)ControlClick("Save As", "", 1)WinActivate("Sound Recorder", "")WinClose("Sound Recorder", "");*******************************************************************************;Completion Notice;*******************************************************************************Opt("GUIOnEventMode", 1) ; Change to OnEvent mode$started = 1$mainwindow = GUICreate("Sound Recorder", 210, 110)GUICtrlCreateLabel("Recording saved to tutor", 42, 28)$btnExit = GUICtrlCreateButton("OK", 70, 70, 65)GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")GUICtrlSetOnEvent($btnExit, "_Terminate")GUISetState(@SW_SHOW)While 1 for $i = 5 to 1 Step -1 GUICtrlSetData($btnExit,"OK (" & $i & ")") Sleep(1000) Next If $started Then GUIDelete($mainwindow) EndIf ExitWEndFunc _Terminate() $started = 0 ExitEndFunc Link to comment Share on other sites More sharing options...
gcue Posted April 13, 2012 Share Posted April 13, 2012 (edited) in your while loop do a if not processexists("3rdparty.exe") then exit Edited April 13, 2012 by gcue Link to comment Share on other sites More sharing options...
chiners_68 Posted April 13, 2012 Author Share Posted April 13, 2012 Like this While 1 for $i = 5 to 1 Step -1 GUICtrlSetData($btnExit,"OK (" & $i & ")") Sleep(1000) Next if not processexists("SoundRecorder.exe") then Exit Next If $started Then GUIDelete($mainwindow) EndIf Exit WEnd Func _Terminate() $started = 0 Exit EndFunc Link to comment Share on other sites More sharing options...
EndFunc Posted April 13, 2012 Share Posted April 13, 2012 Like this While 1 for $i = 5 to 1 Step -1 GUICtrlSetData($btnExit,"OK (" & $i & ")") Sleep(1000) Next if not processexists("SoundRecorder.exe") then Exit Next If $started Then GUIDelete($mainwindow) EndIf Exit WEnd Func _Terminate() $started = 0 Exit EndFunc Maybe... While 1 for $i = 5 to 1 Step -1 GUICtrlSetData($btnExit,"OK (" & $i & ")") Sleep(1000) Next If $started AND Not ProcessExists("SoundRecorder.exe") Then GUIDelete($mainwindow) Exit EndIf WEnd Func _Terminate() $started = 0 Exit EndFunc EndFuncAutoIt is the shiznit. I love it. 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