Re: Preview.app scriptable
Re: Preview.app scriptable
- Subject: Re: Preview.app scriptable
- From: "R. Nelson Byrne" <email@hidden>
- Date: Tue, 26 Jan 2010 14:59:26 -0800
I find a similar problem with Numbers.app v 2.0.3 (332), running a
sample script kindly supplied by M. Koenig. The script wants System
Events to do something with window 1, but it fails to do so. If
(following the lead of the OP) I change the script to do something
with window 2, it works.
PreFab UI Browser v2.0.5 (93), running on my dual 2.0 G5, 10.5.8, says
that app "Numbers" has only two children, and they are {standard
window "XYZ" (window 1), menu bar (menu bar 1)}. XYZ is in fact the
name of the Numbers document in question, so that makes sense. But why
should the script need to address a non-existant window 2?
As you see below, M. Koenig suggested looping over windows and
checking their names. When I do that I find that System Events reports
there are TWO windows, not the ONE found by the UI Browser. Their
names are {"Table", "XYZ"}. So I put in a loop over windows to find
the (first, of who knows how many?) one with the [name of the document
whose index is 1} and use that window number to talk to System Events.
In this case it's 2, and there are only the two windows. I don't know
what window "Table" is. Anyhow it works on this one example, my first
try at scripting Numbers. Maybe it's a general fix. But how about all
those other GUI elements????
I understand the UI Browser is supposed to work with 10.5.8, but
perhaps it is imperfect. Or perhaps I'm just completely muddled.
I welcome comments and insight.
Thanks,
Nelson Byrne
On Jan 13, 2010, at 10:51 PM, applescript-users-
email@hidden wrote:
Message: 1
Date: Wed, 13 Jan 2010 22:40:18 +0100
From: Yvan KOENIG <email@hidden>
Subject: Re: Preview.app scriptable
To: Applescript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset="utf-8"
Le 13 janv. 2010 à 21:44, Gmeiner Jobst a écrit :
Hi Robert and Yvan,
thank you again for your mails. Now, I am totally confused and not
amused!
As I reported before, the 'first window' didn't move at all when
scripted. By accident then I adressed window 2, and voilà , it did
what it should (using 'size' and 'position' as you suggested,
'bounds' are not working).
Then, I asked for the name of window 2 and got the result I see on
top of the window of the jpg-file on the screen:
tell application "System Events"
get name of window 2 of application process "Preview"
--> "1966_12_25_Michaelkalender.jpg"
end tell
Asking for the name of window 1 I got nothing:
tell application "System Events"
get name of window 1 of application process "Preview"
end tell
Then, I repeated everything from the scratch starting 'Preview'
with double clicking a random jpg.-file >> same result.
Then, I repeated everything from the scratch starting 'Preview'
with double clicking a random jpg.-file on my MacBook >> same
result.
Therefore, when I use in the script the name of the window instead
of the number, everything seems to be OK!
Could you tell me by chance what's all about the 'ghost' window 1
of Preview.app ?
Thanks for your patience
Jobst
I don't know what is this ghost window.
For safe, you may ask the name of every windows and look at it.
Given what wrote Robert (its original script does the trick),
maybe Preview starts the window numbering to 2 so that its first
window is not window 1 but window 2 ????
Yvan KOENIG (VALLAURIS, France) mercredi 13 janvier 2010 22:40:07
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/applescript-users/attachments/20100113/efac11c7/attachment.html
_______________________________________________
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