-
Posts
19 -
Joined
-
Last visited
money's Achievements

Seeker (1/7)
1
Reputation
-
ClayAsh reacted to a post in a topic: _ReduceMemory UDF
-
Yes, please update your code.
-
RawCopy - low level file copying (extraction)
money replied to joakim's topic in AutoIt Example Scripts
Who knew accessing the MFT was possible in AutoIt?? Bumping so maybe someone with more experience will find use out of it -
Has anyone attempted to use the brand new AutoIt 3.3.8 with standard 7za.dll? If not then, would someone else mind maintaining this, rasim seesm to have lost interest...
-
_RandomUnique - Generate unique random numbers [updated 2011-11-24]
money replied to money's topic in AutoIt Example Scripts
Updated. @Martin. Initially shuffle was an after thought, actually copy/paste from an older script that I forgot to update. You're right though, it shuffled terribly. I changed it, and now results are much better. -
Crypt.au3 Hasher Example v1.0 I needed something to generate hash files of multiple files so I whipped this up really quick. It utitlizes the standard Crypt.au3 UDF and by Yashied. _WinAPI_DragQueryFileEx _WinAPI_DragFinish _WinAPI_PathIsDirectory Essentially a very basic and unoptimized version of HashMyFiles. When I get the time, I'll add more features, fix bugs, etc. Features: Drag and drop supportMultiple file supportSave results to text fileUses standard hashing functionsScreenshot: License: Crypt.au3 Hasher v1.0 Example by money Licensed under the public domain, use as you wish. Download: Hasher.au3 Changelog: 1.0 - 2011/11/23: Initial release (reuploaded correct version)
-
Some older functions that were collecting dust. _StringShuffle - Shuffles characters of a string _StringUnique - Return unique/non-dupe characters from a string _StringSort - Sort characters of a string _ArrayShuffle - Takes the given array and shuffles the order in which the elements appear in the array. Functions: Global $sString ; _StringShuffle Example $sString = _StringShuffle("The barking fat and yellow dog wore two collars for good luck") MsgBox(0, '', $sString) ; _StringUnique Example $sString = "abb2222bbbcccccc1112222223333" MsgBox(0, 'before',$sString) $sString = _StringUnique($sString) MsgBox(0, 'after',$sString) ; _StringSort Example #include <Array.au3> $sString = "ybhg73vdhvygczi87%$86bgtdfHHjNJUI*d_" MsgBox(0, 'before', $sString) $sString = _StringSort($sString, 0, 0, 0) MsgBox(0, 'after', $sString) ; Shuffles characters of a string ; by money Func _StringShuffle($sString, $sDelim = "") Local $sOutString, $iA, $cTmp ;Convert string to an array of characters for easier processing Local $aCharArray = StringSplit($sString, $sDelim, 1) ;Go through entire string length For $i = 1 To $aCharArray[0] ;Pick A random placement $iA = Random(1, $aCharArray[0], 1) ;Do nothing for same value placements If $i = $iA Then ContinueLoop ;random fails at this point, get value of last element If $iA = 0 Then $iA = $aCharArray[0] ;Store copy of 1st element value $cTmp = $aCharArray[$i] ;Overwrite 1st element value with 2nd element value $aCharArray[$i] = $aCharArray[$iA] ;Overwrite 2nd element value with 1st element value $aCharArray[$iA] = $cTmp Next ;Rebuild the string For $i = 1 To $aCharArray[0] $sOutString &= $aCharArray[$i] & $sDelim Next Return $sOutString EndFunc ;==>_StringShuffle ; Return unique/non-dupe characters from a string ; by money Func _StringUnique($sString) Local $sChr, $iASCII, $iStrLoc = 0, $iStrLen = StringLen($sString), $sOutString = "" While $iStrLoc < $iStrLen $iStrLoc += 1 ;Get the next character $sChr = StringMid($sString, $iStrLoc, 1) ;Get the ASCII code of the current character $iASCII = AscW($sChr) ;Check if the assigned ASCII code already exists If IsDeclared($iASCII) <> -1 Then ;Assign the ASCII code as a local variable Assign($iASCII, '', 1) $sOutString &= $sChr EndIf WEnd Return $sOutString EndFunc ;==>_StringUnique ; Sort characters of a string ; requires #include <Array.au3> ; by money Func _StringSort($sString, $iDesc = 0, $iStart = 0, $iEnd = 0) Local $aCharArray, $sOutString = "" Local $aCharArray = StringSplit($sString, "", 2) Local $iUbound = UBound($aCharArray)-1 If $iEnd = 0 Then $iEnd = $iUbound __ArrayQuickSort1D($aCharArray, $iStart, $iEnd) If $iDesc = 1 Then For $i = $iUbound To 0 Step -1 $sOutString &= $aCharArray[$i] Next Else For $i = 0 To $iUbound Step 1 $sOutString &= $aCharArray[$i] Next EndIf Return $sOutString EndFunc ;==>_StringSort Bonus: _ArrayShuffle ; Begin Example ===================== #include <Array.au3> Local $avArray[10] $avArray[0] = "JPM" $avArray[1] = "Holger" $avArray[2] = "Jon" $avArray[3] = "Larry" $avArray[4] = "Jeremy" $avArray[5] = "Valik" $avArray[6] = "Cyberslug" $avArray[7] = "Nutster" $avArray[8] = "JdeB" $avArray[9] = "Tylo" _ArrayDisplay($avArray, "$avArray BEFORE _ArrayShuffle()") _ArrayShuffle($avArray) _ArrayDisplay($avArray, "$avArray AFTER _ArrayShuffle()") ; End Example ===================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArrayShuffle ; Description ...: Takes the given array and shuffles the order in which the elements appear in the array. ; Syntax.........: _ArrayShuffle(ByRef $avArray[, $iStart = 0[, $iEnd = 0]]) ; Parameters ....: $avArray - Array to shuffle ; $iStart - [optional] Index of array to start modifying at ; $iEnd - [optional] Index of array to stop modifying at ; Return values .: Success - 1 ; Failure - 0, sets @error to: ; |1 - $avArray is not an array ; |2 - $iStart is greater than $iEnd ; |3 - $avArray is not a 3 dimensional array ; Author ........: money ; Modified.......: ; Remarks .......: ; Related .......: _ArrayReverse, _ArraySort ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _ArrayShuffle(ByRef $avArray, $iStart = 0, $iEnd = 0) If Not IsArray($avArray) Then Return SetError(1, 0, 0) Local $iUBound = UBound($avArray, 1) - 1 If Not $iUBound Then Return SetError(2, 0, 0) Local $iDimension = UBound($avArray, 0) If $iDimension > 3 Then Return SetError(3, 0, 0) If ($iEnd > 0) And (($iUBound-$iEnd) < $iUBound) And (($iUBound-$iEnd) > $iStart) Then $iUBound -= $iEnd Local $iA, $vTmp For $i = $iStart To $iUBound ;Pick a random placement $iA = Random($iStart, $iUBound, 1) ;Do nothing for same value placements If $i = $iA Then ContinueLoop ;random fails at this point, get value of last element If $iA = 0 Then $iA = $iUBound Switch $iDimension Case 1 ;Store copy of 1st element value $vTmp = $avArray[$i] ;Overwrite 1st element value with 2nd element value $avArray[$i] = $avArray[$iA] ;Overwrite 2nd element value with 1st element value $avArray[$iA] = $vTmp Case 2 ;2D array For $x = 0 To UBound($avArray, $iDimension)-1 $vTmp = $avArray[$i][$x] $avArray[$i][$x] = $avArray[$iA][$x] $avArray[$iA][$x] = $vTmp Next EndSwitch Next Return 1 EndFunc ;==>_ArrayShuffle Updated 2011/11/24 - fixed shuffling
-
About: _RandomUnique: Returns an array of unique random numbers I found by billthecreator that was posted a while back. Insufficient for my needs (note the concerns of WideBoyDixon), I wrote my own function. Features: Sanity checkCommented codeFastExample: #include <Array.au3> Global $iTime, $aRandom ; Example #1 - Return five unique numbers from 0 to 10 $iTime = TimerInit() $aRandom = _RandomUnique(5, 0, 10, 1) ConsoleWrite("_RandomUnique = " & @error &" : "& @extended &@lf) $iTime = Round(TimerDiff($iTime)/1000, 5) _ArraySort($aRandom, 0, 1) _ArrayDisplay($aRandom, "Example #1 Generated in: "& $iTime &" sec", 100) Function: ; #FUNCTION# ==================================================================================================================== ; Version........: 1.1 - 2011/11/24 ; Name...........: _RandomUnique ; Description ...: Returns an array of unique random numbers ; Syntax.........: _RandomUnique($iCount, $nMin, $nMax, [$iInt = 0, [$nSeed = Default]]) ; Parameters ....: $iCount - The amount of numbers to generate Number between 1 and 10^6-1 ; $nMin - The smallest number to be generated. Number between -2^31 and 2^31-1 ; $nMax - The largest number to be generated. Number between -2^31 and 2^31-1 ; $iInt - [optional] If this is set to 1 then an integer result will be returned. Default is a floating point number. ; $nSeed - [optional] Seed value for random number generation. Number between -2^31 and 2^31-1 ; Return values .: Success - Returns a 1-dimensional array containing only unique numbers ; $Array[0] = count of generated numbers ; $Array[1] = first number ; $Array[2] = second number, etc ; Failure - Returns 0 and sets @error: ; | 1 - $iCount is too small ; | 2 - $iCount is too large ; | 3 - $nMin and $nMax are equal ; | 4 - $nMin is larger than $nMax ; | 5 - $nMin or $nMax exceeds limit ; | 6 - $nSeed exceeds limit ; Author ........: money ; Modified.......: ; Remarks .......: If $iInt is 1 and $iCount exceeds total unique numbers than @extend is set to 1 and item count is adjusted to the ; + maximum numbers that can be returned ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _RandomUnique($iCount, $nMin, $nMax, $iInt = 0, $nSeed = Default) ; error checking Select ; $iCount is too small Case ($iCount < 1) Return SetError(1, 0, 0) ; $iCount is too large Case ($iCount > 10^6-1) Return SetError(2, 0, 0) ; $nMin and $nMax cannot be equal Case ($nMin = $nMax) Return SetError(3, 0, 0) ; $nMin cannot be larger than $nMax Case ($nMin > $nMax) Return SetError(4, 0, 0) ; $nMin or $nMax exceeds limit Case ( ($nMin < -2^31) Or ($nMax > 2^31-1) ) Return SetError(5, 0, 0) EndSelect ; user specific seed If IsNumber($nSeed) Then ; $nSeed exceeds limit If (($nSeed < -2^31) Or ($nSeed > 2^31-1) ) Then Return SetError(6, 0, 0) SRandom($nSeed) EndIf ; $iCount is equal too or exceeds maximum possible unique values Local $iCountInval = 0 If ($iInt) Then ; positive If ($nMin >= 0) Then If ($iCount > ($nMax-$nMin)+1) Then $iCountInval = 1 ElseIf ($iCount = ($nMax-$nMin)+1) Then $iCountInval = 3 EndIf ; negative to positive Else If ($iCount > ($nMax + Abs($nMin)+1)) Then $iCountInval = 2 ElseIf ($iCount = ($nMax + Abs($nMin)+1)) Then $iCountInval = 3 EndIf EndIf EndIf ; courtesy If ($iInt And $iCount = 1) Then Local $aArray[2] = [1, Random($nMin, $nMax, $iInt)] ; $iCount is too large so we will generate as much we can from $nMin to $nMax values ElseIf $iCountInval Then If $iCountInval = 1 Then $iCount = Int($nMax - $nMin)+1 ElseIf $iCountInval = 2 Then $iCount = Int($nMax + Abs($nMin))+1 EndIf ; $iCount is equal to total unique numbers If $iCountInval = 3 Then $iCountInval = 0 Local $aTmp, $iA, $iNumber = $nMin, $aArray[$iCount + 1] = [$iCount] ; add our numbers sequentially (from $iMin to $iMax) For $i = 1 To $aArray[0] $aArray[$i] = $iNumber $iNumber += 1 Next ; swap every x index value with a random index value For $i = 1 To $aArray[0] $iA = Random($i, $aArray[0], 1) If $i = $iA Then ContinueLoop If $iA = 0 Then $iA = $aArray[0] $aTmp = $aArray[$i] $aArray[$i] = $aArray[$iA] $aArray[$iA] = $aTmp Next Else ; everything else is ok, generate unique numbers Local $nRnd, $iStep = 0, $aArray[$iCount + 1] = [$iCount] While ($iStep <= $iCount-1) $nRnd = Random($nMin, $nMax, $iInt) ; check if the number already exist If IsDeclared($nRnd) <> -1 Then $iStep += 1 $aArray[$iStep] = $nRnd ; store our numbers in a local variable Assign($nRnd, '', 1) EndIf WEnd EndIf Return SetError(0, Number($iCountInval > 0), $aArray) EndFunc Changelog: v1.1 - 2011/11/24 Set $nCount limit to 1,000,000 (avoid maximum array count error) Fixed possible conflict with global variables Updated shuffle routine to be more effective [reported by martin] Updated unique number comparison routine [reported by martin] Return values were changed v1.0 - 2011/11/22 Initial release
-
_FileFindEx - Get More from File/Folder Searches
money replied to Ascend4nt's topic in AutoIt Example Scripts
I filed a feature request to return "extended information" as a optional parameter in the FileFindNextFile function, but it was quickly shot down by Valik. http://www.autoitscript.com/trac/autoit/ticket/2045 Thanks for your function, this is much better than waiting for the devs to reconsider. -
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632647%28v=vs.85%29.aspx WM_SIZING Example ; WM_SIZING: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632647%28v=vs.85%29.aspx ; RECT Struct: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162897%28v=vs.85%29.aspx ; Minimum: Windows 2000 Professional ; WM_SIZING Example by money Global Const $WMSZ_LEFT = 1 Global Const $WMSZ_RIGHT = 2 Global Const $WMSZ_TOP = 3 Global Const $WMSZ_TOPLEFT = 4 Global Const $WMSZ_TOPRIGHT = 5 Global Const $WMSZ_BOTTOM = 6 Global Const $WMSZ_BOTTOMLEFT = 7 Global Const $WMSZ_BOTTOMRIGHT = 8 ;~ Global Const $WM_SIZING = 0x0214 ; included in WindowsConstants.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $hGUI, $gcSizingFrom, $gcSizingCoord _Main() Func _Main() $hGUI = GUICreate("$WM_SIZING Example", 407, 298, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST) $gcSizingFrom = GUICtrlCreateLabel("Resizing from: None", 16, 24, 300, 17) $gcSizingCoord = GUICtrlCreateLabel("Coordinates: None", 16, 56, 300, 17) GUICtrlSetResizing($gcSizingFrom, $GUI_DOCKALL) GUICtrlSetResizing($gcSizingCoord , $GUI_DOCKALL) GUIRegisterMsg($WM_SIZING, "WM_SIZING") GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc Func WM_SIZING($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam ; A pointer to a RECT structure with the screen coordinates of the drag rectangle ; To change the size or position of the drag rectangle, an application must change the members of this structure. Local $tRECT = DllStructCreate("int;int;int;int", $ilParam) ; $tagRECT Local $iLeft, $iTop, $iRight, $iBottom $iLeft = DllStructGetData($tRECT, 1) $iTop = DllStructGetData($tRECT, 2) $iRight = DllStructGetData($tRECT, 3) $iBottom = DllStructGetData($tRECT, 4) ;~ ; Uncomment this line have the window stretched to desktop width ;~ DllStructSetData($tRECT, 1, 0) ;left ;~ DllStructSetData($tRECT, 3, @DesktopWidth) ;right $tRECT = 0 GUICtrlSetData($gcSizingCoord, StringFormat("Coordinates: ( Left: %d, Top: %d, Right: %d, Bottom: %d )", $iLeft, $iTop, $iRight, $iBottom)) ; The edge of the window that is being sized Switch BitAND($iwParam, 0xFFFF) ; LoWord Case $WMSZ_LEFT GUICtrlSetData($gcSizingFrom, "Resizing from: Left") Case $WMSZ_RIGHT GUICtrlSetData($gcSizingFrom, "Resizing from: Right") Case $WMSZ_TOP GUICtrlSetData($gcSizingFrom, "Resizing from: Top") Case $WMSZ_TOPLEFT GUICtrlSetData($gcSizingFrom, "Resizing from: Top-left") Case $WMSZ_TOPRIGHT GUICtrlSetData($gcSizingFrom, "Resizing from: Top-right") Case $WMSZ_BOTTOM GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom") Case $WMSZ_BOTTOMLEFT GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom-left") Case $WMSZ_BOTTOMRIGHT GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom-right") Case Else GUICtrlSetData($gcSizingFrom, "Resizing from: Nsone") EndSwitch Return $GUI_RUNDEFMSG EndFunc Maybe someone can find something more exciting to do with this
-
A reply to this topic regarding "If Then vs. If Then Endif": which belongs on a entirely topic: Results: Variable [pun intended] Global $eatit, $choice, $stop_watch, $cheese = 1, $laps = 10000 Global $winner[2] = [100000000, 0], $rat[4] = [0,0,0,0], $names[4] = ["If then","If Then EndIf","Switch","Select"] ConsoleWrite("The mouse are asleep, releasing the cheese " &@LF) ConsoleWrite("The cheese is being tested: ") $eatit = TimerInit() ;WARMUP For $i = 1 To 10 Sleep(10) If $cheese = $cheese Then $cheese = $cheese If $cheese = $cheese Then $cheese = $cheese EndIf Switch $cheese Case $cheese $cheese = $cheese EndSwitch Select Case $cheese = $cheese $cheese = $cheese EndSelect Next ConsoleWrite("FDA Approved" &@LF) $choice = InputBox("Pick the winning rat", StringFormat("0 = If then\r\n1 = If Then EndIf\r\n2 = Switch\r\n3 = Select"), 0) ConsoleWrite(@lf& "Setting race: 4 Contestants after " & $cheese & " cheese for "& $laps & " laps" &@lf) For $i = 1 To $laps ;============================= ; if then $stop_watch = TimerInit() If $cheese = 1 Then $cheese = 1 $rat[0] += TimerDiff($stop_watch) ;============================= ; if then endif $stop_watch = TimerInit() If $cheese = 1 Then $cheese = 1 EndIf $rat[1] += TimerDiff($stop_watch) ;============================= ; switch $stop_watch = TimerInit() Switch $cheese Case 1 $cheese = 1 EndSwitch $rat[2] += TimerDiff($stop_watch) ;============================= ; select $stop_watch = TimerInit() Select Case $cheese = 1 $cheese = 1 EndSelect $rat[3] += TimerDiff($stop_watch) Next $eatit = TimerDiff($eatit) ConsoleWrite(@lf& "+ the results are in!!!" &@lf) ConsoleWrite( "> ========================================================================" &@lf) ConsoleWrite( "> "& $names[0] &": "&@TAB& "avg: "& Round($rat[0] / $laps, 15) &", total: "& Round($rat[0],15) &@lf) ConsoleWrite( "> "& $names[1] &": "&@TAB& "avg: "& Round($rat[1] / $laps, 15) &", total: "& Round($rat[1],15) &@lf) ConsoleWrite( "> "& $names[2] &": "&@TAB& "avg: "& Round($rat[2] / $laps, 15) &", total: "& Round($rat[2],15) &@lf) ConsoleWrite( "> "& $names[3] &": "&@TAB& "avg: "& Round($rat[3] / $laps, 15) &", total: "& Round($rat[3],15) &@lf) ConsoleWrite( "> ========================================================================" &@lf) ConsoleWrite( "+ ...and the winner was: " ) For $i = 0 To UBound($rat)-1 If $rat[$i] < $winner[0] Then $winner[0] = $rat[$i] $winner[1] = $i EndIf Next ConsoleWrite( StringUpper( $names[$winner[1]]) & @lf) If $winner[1] = $choice Then ConsoleWrite("+Good choice, you picked the right rat!" & @lf) Else ConsoleWrite("Better luck next time." & @lf) EndIf ConsoleWrite("> Notice: A total of " & (Round($eatit,4)) &" ms could been taken to EAT the cheese!" &@lf)
-
Decent results: _ArrayAdd from Array.au3 >> 4605.65909913131 _ArrayAddEx function by guinness >> 4743.97667860021 _ArrayAddEx function (no error checking) >> 3535.55046800641 _ArrayAddEx (no function) >> 2084.16125513159 _ArrayAddEx (no ubound) >> 1455.13158795322 Array Add hardcoded >> 742.881008619811 _ArrayAdd was actually set to loop 2000x the rest were loop 99999x
-
Yes, That does indeed work.
-
Hi, Having trouble with _WinAPI_GetFileAttributes on Windows XP SP3 - X86 / Limited User Account Description: When "GetFileAttributesW" fails it is returning 4294967295 instead of 0xFFFFFFFF (-1); defeating the error check. Steps to reproduce: 1) A file that is normally inaccessible (e.g. @HomeDrive &"\pagefile.sys" OR @HomeDrive&"\NOEXISTS" Results: Return = 4294967295 Error = 0 Expected results: Return = 0 Error = 1 Test file: #include <WinAPIEx.au3> test() Func test() Local $ret = _WinAPI_GetFileAttributes(@HomeDrive &"\NOT_EXIST") MsgBox(0, 'NOT EXIST', "ret: "& $ret & " err: "& @error) Local $ret = _WinAPI_GetFileAttributes(@HomeDrive &"\pagefile.sys") MsgBox(0, 'PAGEFILE', "ret: "& $ret & " err: "& @error) ; windows xp sp3 - x86 / limited user account ;~ return = 4294967295 ;~ error = 0 EndFunc - money Edit: too many edits!! and forgot to mention my os arch Edit #2: I have a question, why does this API fail (error code: 32) for in-use files such as pagefile,sys... while cmd and explorer (both running under same account) do not ?
-
_ArrayUnique - Proposed change to standard UDF
money replied to wraithdu's topic in AutoIt Example Scripts
Work around local $sVar $sVar = Hex(StringToBinary($aArray[$i])) If Not IsDeclared($sVar & '$') Then Assign($sVar & '$', 0, 1) Func _ArrayUniqueFast(ByRef Const $aArray, ByRef $aUnique, $bCaseSensitive = True) ;author: Yashied taken from http://www.autoitscript.com/forum/topic/122192-arraysort-and-eliminate-duplicates/page__p__848191#entry848191 ; fixes invalid characters/case sensitivy issues Local $sData = '', $sSep = ChrW(160), $sVar For $i = 0 To UBound($aArray) - 1 If $bCaseSensitive Then $sVar = Hex(StringToBinary(StringLower($aArray[$i]))) Else $sVar = Hex(StringToBinary($aArray[$i])) EndIf If Not IsDeclared($sVar) Then Assign($sVar, 0, 1) $sData &= $aArray[$i] & $sSep EndIf Next $aUnique = StringSplit(StringTrimRight($sData, 1), $sSep) EndFunc ;==>_ArrayUniqueFast Edit: Add case sensitivity flag -
A joke... Here's my take on this: ;_ReduceMemory Example Global $Ret = _ReduceMemory() ConsoleWrite('_ReduceMemory: Return='& $Ret &' @error=' & @error &@lf) Sleep(10000) ;_ReduceMemory UDF Func _ReduceMemory($PID = 0) ; Discussion: http://www.autoitscript.com/forum/topic/13399-reducememory-udf ; Description: Removes as many pages as possible from the working set of the specified process. ; Return: Success = 1, Failure = 0 ; Based on _WinAPI_EmptyWorkingSet by Yashied w/ proper access flags Local $Ret If (Not $PID) Then $Ret = DllCall("kernel32.dll", "handle", "GetCurrentProcessId") If @error Or (Not $Ret[0]) Then Return SetError(1, 0, 0) $PID = $Ret[0] EndIf Local $hProcess = DllCall('kernel32.dll', 'ptr', 'OpenProcess', 'dword', 0x00000700, 'int', 0, 'dword', $PID) If (@error) Or (Not $hProcess[0]) Then Return SetError(2, 0, 0) Local $Ret = DllCall(@SystemDir & '\psapi.dll', 'int', 'EmptyWorkingSet', 'ptr', $hProcess[0]) If (@error) Or (Not $Ret[0]) Then $Ret = 0 DllCall('kernel32.dll', 'int', 'CloseHandle', 'ptr', $hProcess[0]) If Not IsArray($Ret) Then Return SetError(3, 0, 0) Return 1 EndFunc ;==>_ReduceMemory