@ahmic/autoit-js
Version: 
Node.js bindings for AutoItX3.dll
58 lines (57 loc) • 1.77 kB
TypeScript
/**
 * Enumeration for process priority levels.
 *
 * @see https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass
 */
export declare enum Priority {
    /** Low priority */
    Low = 0,
    /** Below normal priority */
    BelowNormal = 1,
    /** Normal priority */
    Normal = 2,
    /** Above normal priority */
    AboveNormal = 3,
    /** High priority */
    High = 4,
    /** Realtime priority */
    Realtime = 5
}
/**
 * Sets the priority of a process.
 *
 * @param process The name or PID of the process.
 * @param priority The priority level to set. See {@linkcode Priority} for details.
 *
 * @returns 1 if successful, 0 otherwise.
 *
 * @example
 * ```typescript
 * import { ProcessSetPrioritySync } from '@ahmic/autoit-js';
 *
 * const result = ProcessSetPrioritySync('notepad.exe', 1);
 * console.log(result); // Output: 1 if successful, 0 otherwise
 * ```
 *
 * @see https://www.autoitscript.com/autoit3/docs/functions/ProcessSetPriority.htm
 */
export declare function ProcessSetPrioritySync(process: string, priority: Priority): number;
/**
 * Sets the priority of a process.
 *
 * @param process The name or PID of the process.
 * @param priority The priority level to set. See {@linkcode Priority} for details.
 *
 * @returns A promise that resolves to 1 if successful, or 0 otherwise.
 *
 * @example
 * ```typescript
 * import { ProcessSetPriority } from '@ahmic/autoit-js';
 *
 * const result = await ProcessSetPriority('notepad.exe', 1);
 * console.log(result); // Output: 1 if successful, 0 otherwise
 * ```
 *
 * @see https://www.autoitscript.com/autoit3/docs/functions/ProcessSetPriority.htm
 */
export declare function ProcessSetPriority(process: string, priority: Priority): Promise<number>;