Re: newbie question
Re: newbie question
- Subject: Re: newbie question
- From: Mr Tea <email@hidden>
- Date: Fri, 28 Feb 2003 23:23:51 +0000
This from Jonathan Brassow - dated 28-02-03 08714pm:
>
In the first chunk of code, the position property of the first window
>
is understood, but in the second chunk, Applescript thinks that
>
position is a variable - not a property.
When a tell block is compiled, AppleScript looks at the named application's
dictionary so that any terms specific to that application are recognised.
If, as in your second example, the application's name is written into a
variable this does not occur, and the word 'position', although included in
many application scripting suites, is not part of AppleScript's core
terminology (CMIIR) - so it means nothing.
There is a little trick that involves wrapping a tell block in a 'using
terms from' block, where you can specify an application, but that may defeat
the object of your script, and is complicated by the issues noted by Paul
Berkowitz.
On a side note, you can use terminology from an application that isn't the
one you are targeting in your tell block - as long as the context of that
terminology is similar to that in your target application.
So, this works:
set bah to "Finder"
-- specifying app name through a var
using terms from application "Path Finder"
tell application bah
set pos to the position of the first window
end tell
end using terms from
display dialog (("(" & first item of pos as string) & ", " & last item of
pos as string) & ")"
It works with 'terms from' GraphicConverter, Internet Explorer and iView
MediaPro too, probably because these applications that grok the notion of
browser windows. But most apps think primarily in terms of document windows,
and won't help you here.
Incidentally, I noticed that 'bounds' is significantly more robust than
'position' in this situation.
Regards
Nick
(pp Mr Tea)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.