rafu5418 Posted December 6, 2008 Share Posted December 6, 2008 (edited) Dear friends, im really worried about my project. i need a script which will monitor a particular 'win title' and delete that file form my hard drive if it's opened .. please guys help me ! Edited December 6, 2008 by rafu5418 Link to comment Share on other sites More sharing options...
martin Posted December 6, 2008 Share Posted December 6, 2008 Dear friends, im really worried about my project. i need a script which will monitor a particular 'win title' and delete that file form my hard drive if it's opened .. please guys help me !If it's opened how are you going to delete it? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
rafu5418 Posted December 6, 2008 Author Share Posted December 6, 2008 script will terminate the process and then it will delete the file. Thank you Link to comment Share on other sites More sharing options...
AzKay Posted December 6, 2008 Share Posted December 6, 2008 WinList(), ProcessList(), WinGetProcess(), Something along those lines maybe. Im sure theres some Process UDF's around somewhere too. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
rafu5418 Posted December 6, 2008 Author Share Posted December 6, 2008 how do i start ? any one have any examples ? it will be very help full .. Link to comment Share on other sites More sharing options...
Innovative Posted December 6, 2008 Share Posted December 6, 2008 Use Winlist() to list all the windows and if any matched just use ProcessClose() to kill it ? As easy as that . Link to comment Share on other sites More sharing options...
rafu5418 Posted December 6, 2008 Author Share Posted December 6, 2008 the script will monitor a win title 'rafu' if the title 'rafu' is opened the script will ProcessClose() and delete that file from location, where it's opened from. Link to comment Share on other sites More sharing options...
Josbe Posted December 6, 2008 Share Posted December 6, 2008 the script will monitor a win title 'rafu'if the title 'rafu' is opened the script will ProcessClose() and delete that file from location, where it's opened from.Ok. You have the algorithm. Now implement the AutoIt functions. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
rafu5418 Posted December 6, 2008 Author Share Posted December 6, 2008 (edited) #Include <File.au3> #Include <Array.au3> #include<Date.au3> #include <WinAPI.au3> #include <Process.au3> ;--- $file= "rafu project" ;--- StringInStr($file, "rafu project") ;--- Func _Process_GetPath($iPID_In) Local $hModule = 0 Local $hProc = 0 Local $stString = '' Local $iResult = 0 Local $sPath = '' $hProc = _WinAPI_OpenProcess(BitOR(0x0400, 0x0010), False, $iPID_In) If Not $hProc Then Return SetError(1,0,0) $stString = DllStructCreate("char[260]") DllCall("Psapi.dll", "dword", "GetModuleFileNameEx", _ "hwnd", $hProc, _ "hwnd", $hModule, _ "ptr", DllStructGetPtr($stString), _ "dword", 260) If @error Then Return SetError(2,0,0) $sPath = DllStructGetData($stString, 1) If $sPath = '' Then Return SetError(3,0,0) Else Return $sPath EndIf EndFunc ;==>_GetProcPath ;--- While 1 sleep(50) If WinWaitActive($file) Then $iPID = WinGetProcess($file) $sFullPath = _Process_GetPath($iPID) ConsoleWrite ($sFullPath) ConsoleWrite ($iPID) WinKill($file) FileDelete ($sFullPath) FileDelete ($iPID) EndIf WEnd ;--- how do i delete the 'rafu project' file from my hard drive please help me out ! Edited December 6, 2008 by rafu5418 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