Wednesday, August 16, 2017

#1 2017-08-06 05:05:06 am

johnmathew
Member
Registered: 2009-10-12
Posts: 83

Applescript Mouse Click Help?

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.

Applescript:


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 edited by johnmathew (2017-08-11 06:23:06 am)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)