Jump to content

Recommended Posts

Posted (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 by rafu5418
Posted

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.
Posted

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- #
Posted

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.

Posted (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 by rafu5418

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...