Re: question about iPhoto scripting
Re: question about iPhoto scripting
- Subject: Re: question about iPhoto scripting
- From: kai <email@hidden>
- Date: Sat, 5 Mar 2005 03:01:34 +0000
On Fri, 4 Mar 2005 17:12:26 -0600, Jonathan E Brassow wrote:
On Mar 3, 2005, at 3:02 PM, kai wrote:
<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?
There are some invisible windows present - of which my version of
iPhoto actually has 7: {"iPhoto", "Window", "Slideshow",
"General/Appearance/Sharing", "Window", "HTMLExport Panel", "Window"}.
The first one, "iPhoto", we already know about. The others seem to be
made visible as and when they are required to perform some function or
other. For example, the "Slideshow" window becomes visible when the
"Slideshow" button is hit. The "General/Appearance/Sharing" window
shows only one of those names, depending on the most recent option
selected in the "Mail/Preferences..." menu.
However, this doesn't really solve your problem. You'll see that my
list doesn't include an "Export Photos" window, either - partly because
the iPhoto *application* has a different take on things compared to the
iPhoto *process*.
With only the main iPhoto window visible, I ran this snippet:
-------------------------
tell application "iPhoto" to set appWin to name of windows
tell application "System Events" to tell process "iPhoto" to set
procWin to name of windows
{appWin:appWin, procWin:procWin}
--> {appWin:{"iPhoto", "Window", "Slideshow", "General", "Window",
"HTMLExport Panel", "Window"}, procWin:{"iPhoto"}}
-------------------------
Running the same script, this time with the "Export Photos" window
open too, I got this:
-------------------------
--> {appWin:{"iPhoto", "Window", "Slideshow", "General", "Window",
"HTMLExport Panel", "Window"}, procWin:{"iPhoto", "Export Photos"}}
-------------------------
(Note how the the variable 'appWin' doesn't change - while 'procWin'
contains a list of only visible windows.)
What we do about the problem at your end depends to some extent on
whether or not you get the same results as me.
If your test results are the same, then perhaps there's simply a glitch
in the syntax I've suggested - in which case we could see if a
variation improves matters. For example, instead of:
tell window "Export Photos"
repeat until exists
end repeat
...we might try (sans tell block):
-------------------------
repeat until window "Export Photos" exists
end repeat
-------------------------
...or (possibly even more foolproof):
-------------------------
repeat until "Export Photos" is in name of windows
end repeat
-------------------------
If either of the above work, then we'd obviously need to reintroduce
the tell block for the rest of the script:
tell window "Export Photos"
tell tab group 1
tell radio button "Web Page", etc...
(We'd probably also need to make similar adjustments elsewhere, to
other 'exists' statements.)
However, if your test results are different from mine (or the above
variations don't work anyway), we may have to do a little more
homework... :-)
---
kai
_______________________________________________
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