Advertisement
Niko454

Applescript

Feb 25th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. delay 3
  2. repeat 5 times
  3. tell application "System Events" to key code 31 using control down
  4. end repeat
  5. delay 3
  6. set x to 529
  7. set y to 563
  8.  
  9. do shell script "
  10. /usr/bin/python <<END
  11. import sys
  12. import time
  13. from Quartz.CoreGraphics import *
  14. def mouseEvent(type, posx, posy):
  15. theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
  16. CGEventPost(kCGHIDEventTap, theEvent)
  17. def mousemove(posx,posy):
  18. mouseEvent(kCGEventMouseMoved, posx,posy);
  19. def mouseclick(posx,posy):
  20. mouseEvent(kCGEventLeftMouseDown, posx,posy);
  21. mouseEvent(kCGEventLeftMouseUp, posx,posy);
  22. ourEvent = CGEventCreate(None);
  23. currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
  24. mouseclick(" & x & "," & y & ");
  25. mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
  26. END"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement