public static object[] MoveCursor(params object[] ps) { try { int endX = (int)ps[0]; int endY = (int)ps[1]; int delay = (int)ps[2]; string delayCmd = $"Delay({delay})"; while (true) { var pos = System.Windows.Forms.Cursor.Position; if (pos.X != endX) { pos.X += pos.X < endX ? 1 : -1; } if (pos.Y != endY) { pos.Y += pos.Y < endY ? 1 : -1; } Meths.SetCursorPos(pos.X, pos.Y); if (pos.X == endX && pos.Y == endY) { break; } Interpreter.ExecuteCommand(delayCmd); } } catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); } return(ps); }
public static object[] SetCursorPos(params object[] ps) { try { Meths.SetCursorPos((int)ps[0], (int)ps[1]); } catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); } return(ps); }