Rush
Уже за тридцать... | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Код: appname = "OE.exe" key = "HKCU\Software\MetaProducts\Offline Explorer MX\Parameters\CurrentDir" ProgramFilesPath = createobject("wscript.shell").expandenvironmentstrings("%ProgramFiles%") 'TerminateApp appname RunApp ProgramFilesPath & "\Offline Explorer Enterprise\OE.exe /exit" if CheckClose then pathDir = ReadPath(key) fileWD = pathDir & "\WebDown.dat" DelObjects fileWD, pathDir RunApp ProgramFilesPath & "\Offline Explorer Enterprise\OE.exe" end if sub DelObjects(fname, path) set fso = createobject("scripting.filesystemobject") set txtfile = fso.opentextfile(fname) txt = txtfile.readall txtfile.close if not fso.folderexists(path & "\Temp") then fso.createfolder path & "\Temp" set shapp = createobject("shell.application") shapp.namespace(path & "\Temp").movehere fname, 16 arr = split(txt,"[Object]") arrdesc = filter(arr,"Descr=") str = left(arr(0),instr(arr(0),"ObjectsCount=")+12) & cstr(ubound(arrdesc)+1) & vbcrlf set txtfile = fso.opentextfile(fname, 2, true) txtfile.write str & "[Object]" & join(arrdesc,"[Object]") txtfile.close end sub sub TerminateApp(appname) set srv = getobject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") servname = "select * from win32_process where name = '" & appname & "'" set procs = srv.execquery(servname) for each proc in procs proc.terminate next end sub function ReadPath(key) set wshshell = createobject("wscript.shell") ReadPath = wshshell.regread(key) end function sub RunApp(app) set shapp = createobject("shell.application") shapp.shellexecute app end sub function CheckClose(appname) set srv = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2") servname = "select * from __instancedeletionevent " _ & "within 1 where targetinstance isa 'win32_process' " _ & "and targetinstance.name='" & appname & "'" set mon = srv.execnotificationquery(servname) set app = mon.nextevent CheckClose = true end function | | Всего записей: 3551 | Зарегистр. 20-11-2003 | Отправлено: 15:10 13-04-2009 | Исправлено: Rush, 15:11 13-04-2009 |
|