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: Dalmazio Brisinda <email@hidden>
- Date: Wed, 10 Dec 2008 01:40:30 -0600
Hi all,
First thanks again Bill for this cool script.
Question though to anyone else that can answer.
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.
Best, dalmazio
Message: 9 Date: Sat, 06 Dec 2008 05:05:01 -0500 From: Bill Cheeseman <email@hidden> Subject: Re: How to add keywords to photos in iPhoto? To: AppleScript-Users Mail <email@hidden> Message-ID: <C55FB87D.77355%email@hidden">C55FB87D.77355%email@hidden> Content-Type: text/plain; charset="US-ASCII"
on 2008-12-06 1:30 AM, Dalmazio Brisinda at email@hidden wrote:
does anyone know of a way to programmatically
create keywords prior to attempting to assign them?
You have to use GUI Scripting to control iPhoto's user interface, and turn on the "Enable access for assistive devices" setting in the Universal Access pane of System Preferences.
Apologies for the length of the example below. Note that I haven't used it in the last few months, so changes in very recent versions of iPhoto might have introduced problems.
-- Add Keyword to Selected Photos -- Version 1.0 Bill Cheeseman 2007-12-30
tell application "iPhoto" activate display dialog "Enter a keyword to add to the selected photos." default answer "" set theKeyword to text returned of result if theKeyword is "" then return
-- Use GUI Scripting to add new keyword to iPhoto application. iPhoto can only assign existing keywords to photos. set existingKeywords to name of every keyword if existingKeywords does not contain theKeyword then my openEditKeywordsPanel() my addKeywordToIPhoto(theKeyword) my closeEditKeywordsPanel() end if
-- Add new keyword to each selected photo in iPhoto. set selectedItems to selection repeat with thisPhoto in selectedItems if class of thisPhoto is photo then if name of keywords of thisPhoto does not contain theKeyword then select thisPhoto assign keyword string theKeyword -- to selected photo end if end if end repeat end tell
on openEditKeywordsPanel() activate application "iPhoto" tell application "System Events" tell process "iPhoto" get title of menu item 4 of menu "Window" of menu bar item "Window" of menu bar 1 if result starts with "Show" then keystroke "k" using {command down} if button "Edit Keywords" of front window exists then click button "Edit Keywords" of front window end tell end tell end openEditKeywordsPanel
on addKeywordToIPhoto(thisKeyword) activate application "iPhoto" tell application "System Events" tell process "iPhoto" if (button 6 of front window exists) and (help of button 6 of front window starts with "Create") then click button 6 of front window -- "+" button perform action "AXRaise" of front window keystroke thisKeyword keystroke return click button "Shortcut" of front window key code 51 -- delete automatic shortcut keystroke return end if end tell end tell end addKeywordToIPhoto
on closeEditKeywordsPanel() activate application "iPhoto" tell application "System Events" tell process "iPhoto" if button "OK" of front window exists then click button "OK" of front window get title of menu item 4 of menu "Window" of menu bar item "Window" of menu bar 1 if result starts with "Hide" then keystroke "k" using {command down} end tell end tell end closeEditKeywordsPanel
--
Bill Cheeseman - email@hidden Quechee Software, Quechee, Vermont, USA www.quecheesoftware.com
PreFab Software - www.prefabsoftware.com
------------------------------
Message: 10 Date: Sat, 6 Dec 2008 15:29:03 +0100 From: Roy McCoy <email@hidden> Subject: Re: Sequential renumbering in InDesign CS3 To: email@hidden Message-ID: <email@hidden">email@hidden> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Andrew Brown wrote:
I could do this with auto para numbering but want to have the number
physically present for subsequent processing.
I find a "convert bullets and numbering to text" command in the InDesign CS4 dictionary conforming to the same command under the Type menu, so this could be scripted if necessary. But it isn't in this case, as Shane demonstrated.
Roy McCoy Rotterdam, NL
------------------------------
_______________________________________________ AppleScript-Users mailing list email@hidden http://lists.apple.com/mailman/listinfo/applescript-users
End of AppleScript-Users Digest, Vol 5, Issue 645 ************************************************* |
_______________________________________________
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