Author Topic: Applescript Mouse Click Help?  (Read 71 times)

0 Members and 1 Guest are viewing this topic.

Offline Star123

  • Visitor
  • Posts: 3
  • Karma: 0
Applescript Mouse Click Help?
« on: August 06, 2017, 06:15:09 AM »
Hi Guys,

I am using Mac OS X Yosemite, Apple Script Editor – Version 2.7 and Adobe Acrobat XI.

I would like to go the respective Tag for the Current Selection in the Tag Panel.

So Far What I doing is,
1. Selecting Text
2. Clicking Option Button in Tag Panel and
3. Clicking “Find Tag From Selection” from the list.

As of Now I am using the below script. But it take more time to click.

Code: [Select]
tell application "Adobe Acrobat Pro"
   activate
   set x to 50
   set y to 180
   
   do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END"


set x to 50
set y to 310

do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END"

end tell

By Applescript or Javascript, Can it possible to Click “Find Tag From Selection” on the Tag Panel?


Any Help would be appreciated.


Thanks,
Mathew
« Last Edit: August 11, 2017, 06:37:59 AM by Star123 »

Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: Applescript Mouse Click Help?
« Reply #1 on: August 17, 2017, 02:36:52 AM »
Hi!

Acrobat is not very Applescript-friendly.
One way is to use UI Browser.app (from http://pfiddlesoft.com/uibrowser/) and try to isolate the button you wish in one way or another via UI scripting.
HTH.
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz • 10 Go 1066 MHz DDR3 • Mac OS 10.8.5 • QuarkXPress 9.5.4.1 • Adobe CS5 =