Publi-Script Forums

Applescript / Javascript => Adobe Acrobat scripting => Topic started by: Star123 on August 06, 2017, 06:15:09 AM

Title: Applescript Mouse Click Help?
Post by: Star123 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
Title: Re: Applescript Mouse Click Help?
Post by: Jean-Marie Schwartz 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.