robotgo_fn_v1.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package robotgo
  2. import "github.com/vcaesar/tt"
  3. // Deprecated: use the Move(),
  4. //
  5. // MoveMouse move the mouse
  6. func MoveMouse(x, y int) {
  7. Move(x, y)
  8. }
  9. // Deprecated: use the DragSmooth(),
  10. //
  11. // DragMouse drag the mouse to (x, y),
  12. // It's same with the DragSmooth() now
  13. func DragMouse(x, y int, args ...interface{}) {
  14. Toggle("left")
  15. MilliSleep(50)
  16. // Drag(x, y, args...)
  17. MoveSmooth(x, y, args...)
  18. Toggle("left", "up")
  19. }
  20. // Deprecated: use the MoveSmooth(),
  21. //
  22. // MoveMouseSmooth move the mouse smooth,
  23. // moves mouse to x, y human like, with the mouse button up.
  24. func MoveMouseSmooth(x, y int, args ...interface{}) bool {
  25. return MoveSmooth(x, y, args...)
  26. }
  27. // Deprecated: use the function Location()
  28. //
  29. // GetMousePos get the mouse's position return x, y
  30. func GetMousePos() (int, int) {
  31. return Location()
  32. }
  33. // Deprecated: use the Click(),
  34. //
  35. // # MouseClick click the mouse
  36. //
  37. // robotgo.MouseClick(button string, double bool)
  38. func MouseClick(args ...interface{}) {
  39. Click(args...)
  40. }
  41. // Deprecated: use the TypeStr(),
  42. //
  43. // # TypeStringDelayed type string delayed, Wno-deprecated
  44. //
  45. // This function will be removed in version v1.0.0
  46. func TypeStringDelayed(str string, delay int) {
  47. tt.Drop("TypeStringDelayed", "TypeStrDelay")
  48. TypeStrDelay(str, delay)
  49. }
  50. // Deprecated: use the ScaledF(),
  51. //
  52. // Scale1 get the screen scale (only windows old), drop
  53. func Scale1() int {
  54. dpi := map[int]int{
  55. 0: 100,
  56. // DPI Scaling Level
  57. 96: 100,
  58. 120: 125,
  59. 144: 150,
  60. 168: 175,
  61. 192: 200,
  62. 216: 225,
  63. // Custom DPI
  64. 240: 250,
  65. 288: 300,
  66. 384: 400,
  67. 480: 500,
  68. }
  69. x := ScaleX()
  70. return dpi[x]
  71. }
  72. // Deprecated: use the ScaledF(),
  73. //
  74. // Scale0 return ScaleX() / 0.96, drop
  75. func Scale0() int {
  76. return int(float64(ScaleX()) / 0.96)
  77. }
  78. // Deprecated: use the ScaledF(),
  79. //
  80. // Mul mul the scale, drop
  81. func Mul(x int) int {
  82. s := Scale1()
  83. return x * s / 100
  84. }