Re: question about iPhoto scripting
Re: question about iPhoto scripting
- Subject: Re: question about iPhoto scripting
- From: Jonathan E Brassow <email@hidden>
- Date: Fri, 4 Mar 2005 17:12:26 -0600
On Mar 3, 2005, at 3:02 PM, kai wrote:
On Tue, 1 Mar 2005 15:20:04 -0600, Jonathan E Brassow wrote:
I have a webserver running on my mac. I'd like to make a script that
will:
1) query the user for a photo group name (pgname)
2) create a dir called pgname in /Library/WebServer/Documents
3) Export a specific album in iPhoto, via web page format to that dir
4) Alter the index.html file to include the reference to the exported
iPhoto album
1. is handled by display dialog
2. is handled by finder
4. is handled by a perl script via terminal (perhaps I could get this
done in AS at some point)
#3 is the hard one... I can open iPhoto and select the album, but I
can't export it.
Any ideas?
<snip>
The matter is complicated still further by some of the more deeply
nested UI elements on the export browser sheet, which seem (OMM at any
rate) reluctant to respond to events like 'click', 'select', etc. If
your experience is similar, you may have to resort to a bit of
keystroke subterfuge - as I've done. Anyway, the effort below seems to
do the job here (up to your stage #3), so you could try using it as a
starting point. (Any lines abutting the left-hand edge of the page may
need to be rejoined with the previous line.) Sorry about the length...
--------------
<snip>
to exportAlbum into newFolder at parentFolder
set tabKey to tab
set fullPath to POSIX path of parentFolder & newFolder
tell application "System Events" to tell process "iPhoto"
set frontmost to true
keystroke "e" using {command down, shift down}
While the "Export Photos" window does open, it does not seem to be
available to the script... This causes an infinite loop on the first
repeat following the tell. I've had iPhoto print it's list of windows.
It says that 5 are open - none of them with the name "Export Photos".
It tells me that there are 5 windows, regardless of whether the "Export
Photos" window is open or not. (I'm not sure where it is getting 5 in
the first place...) Any ideas?
tell window "Export Photos"
repeat until exists
end repeat
tell tab group 1
tell radio button "Web Page" to if value is 0 then
click
repeat until value is 1
end repeat
end if
tell group 1 to tell group -1 to tell text field -1 to set value
to newFolder
end tell
tell list -1 to click button "Export"
tell sheet 1
repeat until exists
end repeat
tell group -1
tell group 1 to tell text field 1 to set changeFocus to focused
tell browser 1
tell scroll area 1 to tell radio group 1 to if changeFocus then
keystroke tabKey
repeat until true is in focused of every static text
end repeat
end if
keystroke space
repeat until (count scroll areas) > 1
end repeat
end tell
keystroke tabKey
tell group 1 to tell text field 1
repeat until focused is true
end repeat
set value to fullPath
confirm
repeat until (count value) < 2
end repeat
end tell
end tell
click button "OK"
end tell
repeat until not (exists)
end repeat
end tell
end tell
end exportAlbum
<snip>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden