Re: os x gui scripting
Re: os x gui scripting
- Subject: Re: os x gui scripting
- From: Andrew Farmer <email@hidden>
- Date: Sun, 21 Dec 2008 23:53:04 -0800
On 21 Dec 08, at 06:47, Luca Cioria wrote:
First, I know little of os x programming since I bought my mac 2
weeks ago.
I'd like to develop a set of command line tools that do gui
scripting stuff.
Some examples:
click --> clicks the mouse at x y coordinates, optionally relative to
current window, can be single click, double click, right, middle,
mouse-down
only (no releasing) etc. etc.
getPixel --> get the color of a pixel on the screen at x y
coordinates,
optionally relative to current window.
send --> sends keystrokes
winActivare --> activate a specified window
What you're looking for here is AppleScript. The AppleScript component
"GUI Scripting" has most of the low-level gunk you're looking for, as
well as a lot of higher-level functionality (clicking specified
buttons or views). Scriptable applications can be manipulated in much
better ways - TextEdit, for example, will let you do stuff like
tell application "TextEdit"
set word 3 of paragraph 1 of text of document of front window
to "know"
end tell
Although most of this functionality *is* accessible through Cocoa,
it's a lot more awkward to get at that way, and there's no real
advantage to doing so. If all you're after is an equivalent to AHK,
AppleScript is the way to go.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden