# Function Reference

# ProcessSetPriority

Changes the priority of a process.

ProcessSetPriority ( "process", priority )

## Parameters

process | The name or PID of the process to check.
priority | A flag which determines what priority to set $PROCESS_LOW (0) = Idle/Low $PROCESS_BELOWNORMAL (1) = Below Normal $PROCESS_NORMAL (2) = Normal $PROCESS_ABOVENORMAL (3) = Above Normal $PROCESS_HIGH (4) = High $PROCESS_REALTIME (5) = Realtime (Use with caution, may make the system unstable) Constants are define in "AutoItConstants.au3".

## Return Value

Success: | 1.
Failure: | 0 and sets the @error flag to non-zero.
@error: | 1. 2 if attempting to use an unsupported priority class.

## Related

ProcessList

## Example

    Example()

    Func Example()
        ; Run Notepad
        Run("notepad.exe")

        Local $hWnd = WinWaitActive("[CLASS:Notepad]", "")

        ; Set the priority of the Notepad process to "Idle/Low".
        ProcessSetPriority("notepad.exe", 0)

        ; Wait for 2 seconds.
        Sleep(2000)

        ; Close the Notepad window using the handle returned by WinWaitActive.
        WinClose($hWnd)
    EndFunc   ;==>Example