public static SleepOrAbort ( int milliseconds ) : void | ||
milliseconds | int | |
return | void |
/// <summary> /// Simulates the specified keys being pressed, then released. /// </summary> public static void KeyPress(params Keys[] keys) { KeyDown(keys); ThreadUtils.SleepOrAbort(50); KeyUp(keys); ThreadUtils.SleepOrAbort(50); }
public static void Drag(MouseEvent startFlags, MouseEvent endFlags, Point start, Point end, int delay = 0, bool keepMouseDown = false) { sm_log.Info(Invariant($"Dragging from {start} to {end}; startFlags: {startFlags}; endFlags: {endFlags}")); int delayAfterMove = GlobalDragDelay + delay; int delayAfterMouse = GlobalDragDelay + delay + 50; SetCursorPosition(start); ThreadUtils.SleepOrAbort(delayAfterMove); SendMouseEvent(startFlags); ThreadUtils.SleepOrAbort(delayAfterMouse); SetCursorPosition(end); ThreadUtils.SleepOrAbort(delayAfterMove); if (!keepMouseDown) { SendMouseEvent(endFlags); ThreadUtils.SleepOrAbort(delayAfterMouse); } }
public static void LeftClick(int delay) { SendMouseEvent(MouseEvent.LeftDown); ThreadUtils.SleepOrAbort(delay); SendMouseEvent(MouseEvent.LeftUp); }