예제 #1
0
 /// <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);
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public static void LeftClick(int delay)
 {
     SendMouseEvent(MouseEvent.LeftDown);
     ThreadUtils.SleepOrAbort(delay);
     SendMouseEvent(MouseEvent.LeftUp);
 }