Re: How to add keywords to photos in iPhoto?
Re: How to add keywords to photos in iPhoto?
- Subject: Re: How to add keywords to photos in iPhoto?
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 10 Dec 2008 06:52:46 -0500
- Thread-topic: How to add keywords to photos in iPhoto?
on 2008-12-10 2:40 AM, Dalmazio Brisinda at email@hidden wrote:
> Where do you find the information for the line below when creating new iPhoto
> keywords and the textfield is highlighted waiting for user input?
>
> perform action "AXRaise" of front window
>
> And what does this line actually do? Is it like a set focus? If I tried to
> keystroke xxxx without this line and I just get a series of beeps. As if the
> textfield does not have focus.
The 'perform' command and the 'action' object on which it acts are defined
in the "Processes Suite" of the System Events terminology dictionary. The
System Events application is located in /System/Library/CoreServices. If you
look there, you'll see that an 'action' object has two properties, 'name'
and 'description'. The legal 'name' property values, such as "AXRaise", are
not listed in the dictionary.
The actions recognized by GUI Scripting are defined in Apple's accessibility
API for developers. There are only 9 of them. If you look deeply into the
system frameworks on your Mac, here, you can see all of the actions:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServi
ces.framework/Resources/English.lproj/ActionDescription.strings
To save you the trouble of looking, they are:
/* accessibility action description*/
"AXPress" = "press";
"AXIncrement" = "increment";
"AXDecrement" = "decrement";
"AXConfirm" = "confirm";
"AXAccept" = "accept";
"AXPick" = "pick";
"AXCancel" = "cancel";
"AXRaise" = "raise";
"AXShowMenu" = "show menu";
To see what actions are actually available for a particular object within a
targeted application process, use GUI Scripting. For example, you can see
what actions are recognized by a TextEdit window object by doing this (if
TextEdit is running and at least one window is open):
activate application "TextEdit"
tell application "System Events"
tell process "TextEdit"
tell window 1
get name of every action
end tell
end tell
end tell
The result of running this script is: {"AXRaise"}.
Change the middle line to 'get description of every action', and the result
will be: {"raise"} -- if you're running an English system. If you're running
a German system, for example, the result will be: {" heraufsetzen"}. Thus,
you could use the 'description' property of an 'action' object if you wanted
to give the user some feedback about what is going on.
That doesn't tell you much about what an "AXRaise" action actually does.
I'll tell you -- it brings the window to the front within the targeted
application process. An "AXPress" action causes the targeted application
process to perform a click.
More complete documentation of what each action does can be found in Apple's
developer documentation. Look for the "Accessibility
(ApplicationServices/HIServices) Reference" document at Apple's developer
Web site. If you have Apple's developer tools installed, you can read this
document in Xcode's documentation window: ADC Home > Reference Library >
Reference > User Experience > Accessibility > Accessibility
(ApplicationServices/HIServices) Reference.
The answer to your other question is that the 'keystroke' command
implemented by System Events acts on whichever object in the targeted
application currently has focus. For example, if the front window has
several text fields, you would have to find a way to move the focus to the
text field you want to manipulate before sending the keystroke to the
targeted application. Scripters sometimes don't realize that this means you
don't need to target the text field in your script. It is sufficient to tell
the targeted application process itself to 'keypress "abc"', for example,
and the application will direct the keystrokes to the object having focus.
There is one exception. Keystrokes 'using {command down}' are treated as
keyboard shortcuts. If the targeted application recognizes that keyboard
shortcut, it will execute it. Note that the character specified as the
keyboard shortcut must normally be given in lowercase. If you give it in
uppercase, it will be interpreted as using shift down as well as command
down and you may get unexpected results (some applications do implement a
command-shift-p keyboard shortcut, for example).
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com
PreFab Software - www.prefabsoftware.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden