On Oct 23, 2009, at 8:26 AM, Christopher Stone wrote: On Oct 23, 2009, at 07:19, Luther Fuller wrote: On Oct 22, 2009, at 6:52 PM, Christopher Stone wrote: BTW: How are you managing to reference the front message viewer?
That's just the variable name I use for ... set frontViewer to (message viewer 1)
______________________________________________________________________
Ah. On Leopard 'message viewer 1' does not mean the front message viewer (and neither does 'front message viewer'), so watch out if you have more than one open.
I was wrong. Using ...
set frontViewer to (window index 1)
does not work, either. So, I did some experiments. It seems that, while message viewer windows appear in the indexed list of all windows, message viewer windows have a different indexing scheme when you try to get only message viewer windows.
Finally, I arrived at this handler which returns the frontmost message viewer but which may not be the frontmost window. (It may be covered by a message window.)
on getFrontViewer() tell application "Mail" repeat with i from 1 to (count windows) try (some message viewer whose index is i) return the result end try end repeat end tell error "A message viewer window must be open in Mail." end getFrontViewer -------------------------
This is much more complex than necessary and indicates a bug in the window indexing scheme. (Also, the Mail dictionary says that window indexing is in back to front order. No. Window index 1 is the frontmost window.)
|