Re: question about iPhoto scripting
Re: question about iPhoto scripting
- Subject: Re: question about iPhoto scripting
- From: Jonathan E Brassow <email@hidden>
- Date: Mon, 7 Mar 2005 10:43:05 -0600
On Mar 5, 2005, at 12:52 PM, kai wrote:
<snip>
-------------------------
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"}}
<snip>
I get:
{appWin :{" iPhoto ", " Window ", " Window ", " HTMLExport Panel ", "
Window "}, procWin :{}}
Doesn't look right, does it? And if the original script also failed on
your iMac, my guess is that the behaviour there will be pretty much
similar to that on your iBook. I'm sorry that you're experiencing this
difficulty after I raised your hopes.
Instead of using a checking repeat loop, to allow a process time to
execute a previous statement, some folks simply introduce a delay. I
normally try to avoid that approach - since the execution time can
sometimes vary significantly, depending on what else is going on at
the time. This means that, to avoid a potential error, any delay has
to be more generous than is generally necessary - which in turn slows
down the overall running of the script.
I've actually tried:
repeat until exists
delay 1
end repeat
:)
If we can't find some way around this issue, we may have to resort to
introducing a fixed delay. However I'm still a bit concerned that,
since your iPhoto process evidently doesn't register windows, it may
not even have the ability to issue commands to the "Export Photos"
window (on which the rest of the script is somewhat reliant).
Some brief additional questions:
1) Given your results above, can I assume that the following line
returns a zero?
----------------
tell application "System Events" to tell process "iPhoto" to count
windows
----------------
Yes, count is zero. It is also zero for other open applications with
visible windows, like: Safari, mail, terminal, etc.
2) With the "Export Photos" window open, what happens when you run
this line?
----------------
tell application "System Events" to properties of process "iPhoto"'s
window -1
----------------
System Events got an error: NSReceiverEvaluationScriptError: 4
3) With the "Export Photos" window closed - and then open, what
happens when you run this next line?
----------------
tell application "System Events" to enabled of menu item "iPhoto" of
menu "Window" of menu bar 1 of process "iPhoto"
----------------
System Events got an error: NSReceiverEvaluationScriptError: 4
4) Exactly which version of iPhoto are you running? (See menu:
'iPhoto/About iPhoto'.)
It turns out, I only have iPhoto 2.0.1... I had been keeping my system
up-to-date, but had not been paying to upgrade. Sorry, I think I
misled you by accident in my first message. I'm not sure what version
my iMac has, but I bought it in Nov/Dec.
While this is an obvious difference you and I have, I'm somewhat
reluctant to point the finger at the version of iPhoto I have - given
that the test script for counting windows does not work for me on other
applications either.
I think what I am going to do at this point is go down to the apple
store and try out some of these scripts on their machines and see what
the output is. I'm virtually certain the original script is correct...
I just have to figure out what's going on with my machine.
Thank-you for all the help,
brassow
P.S. I'll try to update the list if I find anything out from going to
the apple store, so that the results can be logged.
_______________________________________________
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