Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Discovering the name of a window

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  a hdmi kabel hdmi kabel ist hdmi kabel lcd belkin..  
Author Message
isw

External


Since: Mar 02, 2006
Posts: 151



(Msg. 1) Posted: Tue Jun 24, 2008 11:22 am
Post subject: Discovering the name of a window
Archived from groups: alt>comp>lang>applescript (more info?)

How can I find out what name to use in an AppleScript to address a
particular window?

I have a two-screen setup -- Macbook plus an external monitor. After
I've used the MacBook stand-alone, I run an AppleScript that rearranges
the windows across the two screens, but there are a couple of windows I
haven't been able to "get ahold of".

One is Mail's "Activity Viewer" window (AppleScript does not acknowledge
that as its name, although that's what it says across the top); the
other is iTunes when it is in the small "control panel" configuration.
When it's in the "big window" configuration, my script moves it just
fine, but not when it's small (so I suppose it has a different name
then?)

So I was wondering, is there some simple AppleScript I could run that
would list *all* visible windows and their names?

thx

Isaac

 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 3627



(Msg. 2) Posted: Tue Jun 24, 2008 12:28 pm
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived

 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
isw

External


Since: Mar 02, 2006
Posts: 151



(Msg. 3) Posted: Tue Jun 24, 2008 8:42 pm
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Michelle Steiner wrote:

> In article ,
> isw wrote:
>
> > So I was wondering, is there some simple AppleScript I could run that
> > would list *all* visible windows and their names?
>
> No. For instance, Applescript does not recognize the existence of
> Mail's Activity Window.

Well, that's not very nice.

But thanks for the info.

Isaac
 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
Jolly Roger

External


Since: Sep 09, 2006
Posts: 1943



(Msg. 4) Posted: Wed Jun 25, 2008 12:14 am
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
isw wrote:

> In article ,
> Michelle Steiner wrote:
>
> > In article ,
> > isw wrote:
> >
> > > So I was wondering, is there some simple AppleScript I could run that
> > > would list *all* visible windows and their names?
> >
> > No. For instance, Applescript does not recognize the existence of
> > Mail's Activity Window.
>
> Well, that's not very nice.

That's just the way it is. Keep in mind AppleScript was never designed
to be a macro utility to access user interface elements. Apple added
this functionality only recently, mainly as a way to give users a
last-resort method of controlling applications that are not scriptable
in the standard way.

--
Please send all responses to the relevant news group rather than directly
to me, as E-mail sent to this address may be devoured by my very hungry
SPAM filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google Groups.
You'll need to use a real news reader if you want me to see your posts.

JR
 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
Sander Tekelenburg

External


Since: Nov 07, 2003
Posts: 648



(Msg. 5) Posted: Wed Jun 25, 2008 6:05 am
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
isw wrote:

> How can I find out what name to use in an AppleScript to address a
> particular window?

Something like this:

get name of every window

(Assuming you really want to target by name. May be fine for your own
personal use, but for scripts that you mean to distribute it may not
(the window might be named differently in other localisations, for
instance). Targeting by id is probably a safer bet.)

> I have a two-screen setup -- Macbook plus an external monitor. After
> I've used the MacBook stand-alone, I run an AppleScript that rearranges
> the windows across the two screens, but there are a couple of windows I
> haven't been able to "get ahold of".
>
> One is Mail's "Activity Viewer" window (AppleScript does not acknowledge
> that as its name, although that's what it says across the top); the
> other is iTunes when it is in the small "control panel" configuration.
> When it's in the "big window" configuration, my script moves it just
> fine, but not when it's small (so I suppose it has a different name
> then?)

This works fine for me, no matter whether the "iTunes" window is set to
full or small:

tell application "iTunes" to set position of window "iTunes" to {100,
100}

[iTunes 7.6.2 under 10.4.11, single screen]

> So I was wondering, is there some simple AppleScript I could run that
> would list *all* visible windows and their names?

It all depends on the app in question; what it makes available for
scripting. (I don't use Mail.app so I've no idea.)

File a bug report with the app's developer if you feel something that
isn't scriptable should be. <http://bugreporter.apple.com/> in this case.

--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>

Mac user: "Macs only have 40 viruses, tops!"
PC user: "SEE! Not even the virus writers support Macs!"
 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
Jean-Marie Schwartz

External


Since: Jun 07, 2007
Posts: 14



(Msg. 6) Posted: Wed Jun 25, 2008 11:53 am
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Vous lisez mes messages et vous faites bien. Le 24/06/08 20:22, isw a
écrit :

> How can I find out what name to use in an AppleScript to address a
> particular window?

Isaac,
Run this code (provided you've open the window you target in Mail):

tell application "Mail" to activate
delay 1
tell application "System Events"
get entire contents of window 1 of application process "Mail" of
application "System Events"
end tell

Then go back into ScriptEditor to read the results.
So you should script "System Events" rather than "Mail" itself.
Hope this helps.

--
Jean-Marie Schwartz

« Je suis le fils de l'homme invisible, je n'ai jamais vu papa » (Sttellla)
 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 3627



(Msg. 7) Posted: Wed Jun 25, 2008 11:53 am
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
Jean-Marie Schwartz

External


Since: Jun 07, 2007
Posts: 14



(Msg. 8) Posted: Thu Jun 26, 2008 10:06 am
Post subject: Re: Discovering the name of a window [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Vous lisez mes messages et vous faites bien. Le 25/06/08 16:58, Michelle
Steiner a écrit :

> In article ,
> Jean-Marie Schwartz wrote:
>
>> Run this code (provided you've open the window you target in Mail):
>
> That returns the buttons and other window items, but doesn't return the
> name of the window, which is what he's trying to get.

Sorry I got it here, among the buttons and other window items.

--
Jean-Marie

« Mi ricordo che un giorno... in mezzo a noi venne un tipo... che ogni cosa
pensava giusto e la fonte della vita era in lui disse una frase... mi rimase
impressa: "Alzati ...e cammina!"... » (Adriano Celentano, «Cammino»)
 >> Stay informed about: Discovering the name of a window 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Window ID - I want to tile finder windows, e.g. placing open windows side by side. If I refer to the window by name, it only works if there are not, say, two home directories open -- if the windows have the same name only one if processed. It seems that the..

Is is possible to script the window manager? - As a long-time X Windows user, I've become very partial to my customised window manager's keyboard shortcuts. Is the OS X Window Manager scriptable or otherwise custimisable? Specifically, I'd like to raise and lower application windows - ideally..

How to suppress the Results window? - I've written a very simple script that archives items on the Mac desktop to a folder elsewhere on the hard drive...the script seems to be working fine, but everytime I run it, I'm getting the results window, which I don't need or want. Is there a way to...

add a drawer to an existing window - Using Interface Builder I am in the need of adding a drawer to an existing window. In the FAQ for Interface Builder it says: If you want to add a drawer to an existing window, just drag in the NSDrawer object (the one that says NSDrawer) and a custom..

OS X arranging finder window by name - How can I script arranging a finder window by name? I'm using 10.2.8. Thanks.
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]