Richard Robertson Posted November 5, 2008 Share Posted November 5, 2008 Try this slight change then. expandcollapse popup#include <Process.au3> Dim $autoits = _GetAutoItProcesses(false) For $i = 1 To $autoits[0][0] ProcessClose($autoits[$i][1]) Next Sleep(5000) For $i = 1 To $autoits[0][0] FileDelete($autoits[$i][1]) Next ;Parameters: [Optional:] $includemy -> include the Process of the executing Script ; Returns Array: ; [0][0] -> ProcessCount ; [$i][0] -> ProcessName ; [$i][1] -> PID ; [$i][2] -> ProcessLocation Func _GetAutoItProcesses($inlcudemy = True) Local $aAutoItWinList = _GetAutoItWinList() Local $Processes[1][3] = [[0,0,0]], $pid For $i = 1 To $aAutoItWinList[0][0] $pid = WinGetProcess($aAutoItWinList[$i][1]) If (Not $inlcudemy) And ($pid = @AutoItPID) Then ContinueLoop $Processes[0][0] += 1 ReDim $Processes[$Processes[0][0]+1][3] $Processes[$Processes[0][0]][2] = _ProcessGetLocation($pid) $Processes[$Processes[0][0]][1] = $pid $Processes[$Processes[0][0]][0] = _ProcessGetName ($pid) Next Return $Processes EndFunc Func _ProcessGetLocation($iPID) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If $aProc[0] = 0 Then Return SetError(1, 0, '') Local $vStruct = DllStructCreate('int[1024]') DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0) Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048) If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '') Return $aReturn[3] EndFunc Func _GetAutoItWinList() Return WinList("[CLASS:AutoIt v3]") EndFunc This one will close all the processes, wait 5 seconds, then start deleting them. Try that. Link to comment Share on other sites More sharing options...
UltraFine Posted November 6, 2008 Author Share Posted November 6, 2008 Try this slight change then. expandcollapse popup#include <Process.au3> Dim $autoits = _GetAutoItProcesses(false) For $i = 1 To $autoits[0][0] ProcessClose($autoits[$i][1]) Next Sleep(5000) For $i = 1 To $autoits[0][0] FileDelete($autoits[$i][1]) Next ;Parameters: [Optional:] $includemy -> include the Process of the executing Script ; Returns Array: ; [0][0] -> ProcessCount ; [$i][0] -> ProcessName ; [$i][1] -> PID ; [$i][2] -> ProcessLocation Func _GetAutoItProcesses($inlcudemy = True) Local $aAutoItWinList = _GetAutoItWinList() Local $Processes[1][3] = [[0,0,0]], $pid For $i = 1 To $aAutoItWinList[0][0] $pid = WinGetProcess($aAutoItWinList[$i][1]) If (Not $inlcudemy) And ($pid = @AutoItPID) Then ContinueLoop $Processes[0][0] += 1 ReDim $Processes[$Processes[0][0]+1][3] $Processes[$Processes[0][0]][2] = _ProcessGetLocation($pid) $Processes[$Processes[0][0]][1] = $pid $Processes[$Processes[0][0]][0] = _ProcessGetName ($pid) Next Return $Processes EndFunc Func _ProcessGetLocation($iPID) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If $aProc[0] = 0 Then Return SetError(1, 0, '') Local $vStruct = DllStructCreate('int[1024]') DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0) Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048) If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '') Return $aReturn[3] EndFunc Func _GetAutoItWinList() Return WinList("[CLASS:AutoIt v3]") EndFunc This one will close all the processes, wait 5 seconds, then start deleting them. Try that. not working at all, just closes the scripts but not deleting them. No Success Link to comment Share on other sites More sharing options...
ProgAndy Posted November 6, 2008 Share Posted November 6, 2008 (edited) This works only, if the Scripts are compiled ... if they are not, you have to try to get the Path from the CMDLine To get the cmdline, use one of the following 2 methods:http://www.autoitscript.com/forum/index.ph...amp;mode=linearor with WMI like here: http://www.autoitscript.com/forum/index.ph...c=70538&hl=@Richard Robertson: You are right... just put the dim on another line ;Parameters: [Optional:] $includemy -> include the Process of the executing Script ; Returns Array: ; [0][0] -> ProcessCount ; [$i][0] -> ProcessName ; [$i][1] -> PID ; [$i][2] -> ProcessLocation Func _GetAutoItProcesses($inlcudemy = True) Local $aAutoItWinList = _GetAutoItWinList() If $aAutoItWinList[0][0]=0 Then Return Local $Processes[$aAutoItWinList[0][0]+1][3] , $pid For $i = 1 To $aAutoItWinList[0][0] $pid = WinGetProcess($aAutoItWinList[$i][1]) If (Not $inlcudemy) And ($pid = @AutoItPID) Then ReDim $Processes[UBound($Processes)-1][3] ContinueLoop EndIf $Processes[0][0] += 1 ;~ $Processes[$Processes[0][0]][2] = _ProcessGetLocation($pid) $Processes[$Processes[0][0]][1] = $pid $Processes[$Processes[0][0]][0] = _ProcessGetName ($pid) Next Return $Processes EndFunc Edited November 6, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
FaT3oYCG Posted November 6, 2008 Share Posted November 6, 2008 hey dont know if this has been answered but here how to add the b, kb, mb , gb or o_O fo how the hell do you have a 1tb file to the end of the actual file size and return it as a string. Func _SizeOfItem($Directory_or_File) If _TypeOfItem($Directory_or_File) = "D" Then If DirGetSize($Directory_or_File) > 1024 * 1024 * 1024 Then Return Round(DirGetSize($Directory_or_File) / 1024 / 1024 / 1024, 2) & " gb" ElseIf DirGetSize($Directory_or_File) > 1024 * 1024 Then Return Round(DirGetSize($Directory_or_File) / 1024 / 1024, 2) & " mb" ElseIf DirGetSize($Directory_or_File) >= 1024 Then Return Round(DirGetSize($Directory_or_File) / 1024, 2) & " kb" ElseIf DirGetSize($Directory_or_File) < 1024 Then Return DirGetSize($Directory_or_File) & " b" EndIf Else If FileGetSize($Directory_or_File) > 1024 * 1024 * 1024 Then Return Round(FileGetSize($Directory_or_File) / 1024 / 1024 / 1024, 2) & " gb" ElseIf FileGetSize($Directory_or_File) > 1024 * 1024 Then Return Round(FileGetSize($Directory_or_File) / 1024 / 1024, 2) & " mb" ElseIf FileGetSize($Directory_or_File) >= 1024 Then Return Round(FileGetSize($Directory_or_File) / 1024, 2) & " kb" ElseIf FileGetSize($Directory_or_File) < 1024 Then Return FileGetSize($Directory_or_File) & " b" EndIf EndIf EndFunc ;==>_SizeOfItem Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right. Link to comment Share on other sites More sharing options...
UltraFine Posted November 6, 2008 Author Share Posted November 6, 2008 This works only, if the Scripts are compiled ... if they are not, you have to try to get the Path from the CMDLine To get the cmdline, use one of the following 2 methods: http://www.autoitscript.com/forum/index.ph...amp;mode=linear or with WMI like here: http://www.autoitscript.com/forum/index.ph...c=70538&hl= @Richard Robertson: You are right... just put the dim on another line ;Parameters: [Optional:] $includemy -> include the Process of the executing Script ; Returns Array: ; [0][0] -> ProcessCount ; [$i][0] -> ProcessName ; [$i][1] -> PID ; [$i][2] -> ProcessLocation Func _GetAutoItProcesses($inlcudemy = True) Local $aAutoItWinList = _GetAutoItWinList() If $aAutoItWinList[0][0]=0 Then Return Local $Processes[$aAutoItWinList[0][0]+1][3] , $pid For $i = 1 To $aAutoItWinList[0][0] $pid = WinGetProcess($aAutoItWinList[$i][1]) If (Not $inlcudemy) And ($pid = @AutoItPID) Then ReDim $Processes[UBound($Processes)-1][3] ContinueLoop EndIf $Processes[0][0] += 1 ;~ $Processes[$Processes[0][0]][2] = _ProcessGetLocation($pid) $Processes[$Processes[0][0]][1] = $pid $Processes[$Processes[0][0]][0] = _ProcessGetName ($pid) Next Return $Processes EndFunc No success yet Tested again by compiling the script but it only closes the running autoit processes but never deletes them. really stuck... Please help! Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 6, 2008 Share Posted November 6, 2008 (edited) You are not providing some key piece of information. Are you getting any errors? What operating system? Are you running as administrator? Are the scripts being run with the same user credentials? Are you able to delete the scripts manually? For that matter, why is it so important that you remove all of these programatically? Can't you just clean it up yourself? Finally, stop sending me PMs on this thread. I am trying to help, so wait for me to come back. I have college and two jobs, I am not here just to help you. Edited November 6, 2008 by Richard Robertson Link to comment Share on other sites More sharing options...
UltraFine Posted November 6, 2008 Author Share Posted November 6, 2008 Are you getting any errors?No, i am not getting any errors but it's not deleting. you can test yourself.What operating system? Microsoft Windows XP Professional Service Pack 2Are you running as administrator? Yes, my user account is AdministratorAre the scripts being run with the same user credentials?i checked the script before compile and after compile on different computers.Are you able to delete the scripts manually?Yes, i tested and i can delete the file without any error message successfully. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2008 Developers Share Posted November 6, 2008 (edited) I am totally lost why one would want to kill and delete all running AutoIT3 scripts. You started explaining that you installed example scripts, but why not remove them manually in stead of spending soo much time on getting a script to run ? It all start sounding a little bit suspicious here .. Edited November 6, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Bert Posted November 6, 2008 Share Posted November 6, 2008 agreed The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
UltraFine Posted November 6, 2008 Author Share Posted November 6, 2008 It all start sounding a little bit suspicious here ..what is suspicious here? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2008 Developers Share Posted November 6, 2008 what is suspicious here?You did read the rest or just the last line? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraFine Posted November 6, 2008 Author Share Posted November 6, 2008 You did read the rest or just the last line?i don't remember which are AutoIt's and also it will be good if i use a autoit script because it's cool.why it sounds like a suspicious script? is it illegal or what? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2008 Developers Share Posted November 6, 2008 i don't remember which are AutoIt's and also it will be good if i use a autoit script because it's cool.why it sounds like a suspicious script? is it illegal or what?Why are you avoiding the question? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted November 6, 2008 Share Posted November 6, 2008 The key to any crime is cleaning up the evidence. Why are you deleting your scripts after they are run? Giggity Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2008 Developers Share Posted November 6, 2008 The key to any crime is cleaning up the evidence. Why are you deleting your scripts after they are run?Please stay out of this discussion for the moment.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraFine Posted November 6, 2008 Author Share Posted November 6, 2008 i think you people don't know how to do it and just making excuses... why it sounds like a suspicious script? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2008 Developers Share Posted November 6, 2008 (edited) i think you people don't know how to do it and just making excuses...why it sounds like a suspicious script?Discussion and thread closed as you seem to be incapable to answer a simple question. Edited November 6, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts