Hello
I am asked to help somebody which is running AppleWorks 6 in 10.4.11.
The problem is to drive the Print Dialog which in this system embed several objects of class AXUnknown.
More, this dialog doesn’t respond to click at {x,y} issued thru System Events.
Searching in the Internet I found several commands but they require at least 10.5.
I found this python script :
## The following is from TonyT ## http://hints.macworld.com/article.php?story=2008051406323031import sys
import time
from Quartz.CoreGraphics import * # imports all of the top-level symbols in the module
class AppleMouseEvents():
“”"
with thanks to:
TonyT http://hints.macworld.com/article.php?story=2008051406323031
example:
m = AppleMouseEvents()
pos = m.currentPos()
m.mousedrag(pos.x,pos.y+float('30'))
"""
def __init__(self):
self.relative = True
def mouseEvent(self,type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(self,posx,posy):
self.mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclickdn(self,posx,posy):
self.mouseEvent(kCGEventLeftMouseDown, posx,posy);
def mouseclickup(self,posx,posy):
self.mouseEvent(kCGEventLeftMouseUp, posx,posy);
def mousedrag(self,posx,posy):
self.mouseEvent(kCGEventLeftMouseDragged, posx,posy);
def mouserclick(self,posx,posy):
self.mouseEvent(kCGEventRightMouseDown, posx,posy);
self.mouseEvent(kCGEventRightMouseUp, posx,posy);
def mousesingleclick(self,posx,posy):
self.mouseclickdn(posx,posy)
self.mouseclickup(posx,posy)
def mousedblclick(self,posx,posy):
self.mousesingleclick(posx,posy)
self.mousesingleclick(posx,posy)
def mousetrplclick(self,posx,posy):
self.mousesingleclick(posx,posy)
self.mousesingleclick(posx,posy)
self.mousesingleclick(posx,posy)
def currentPos(self):
ourEvent = CGEventCreate(None);
return CGEventGetLocation(ourEvent); # Save current mouse position
class AppleKeyboardEvents():
def init(self):
self.relative = True
class AppleWindowEvents():
def init(self):
self.relative = True
but
(1) I don’t know if Python is available in 10.4
(2) if my memory is right a specific task is required to bless such script but I forgot what it is.
Maybe it’s :
[i]
The first is done by executing “chmod +x scriptfile” or perhaps "chmod 755 scriptfile.
$ chmod +x myscript.py[/i]
May you help me ?
KOENIG Yvan (VALLAURIS, France) dimanche 25 août 2013 17:22:52