• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
System Events: window id's instead of window names?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

System Events: window id's instead of window names?


  • Subject: System Events: window id's instead of window names?
  • From: Daniel Brown <email@hidden>
  • Date: Mon, 21 Jun 2010 19:40:57 -0400

Using System Events, is there any way to get id's of windows instead
of just their names?

I've written a little script to horizontally tile the windows of the
current application, but if multiple windows have the same name then
it only finds one of them and fails to tile properly. Here's the
script:

  tell application "Finder"
      set {screenWidth, screenHeight} to {item 3, item 4} of (get
bounds of window of desktop)
  end tell

  tell application "System Events"
      set ws to windows of process (name of first process whose
frontmost = true and visible = true)
      set {width, height} to {screenWidth / (count ws), screenHeight}
      set i to 0
      repeat with w in ws
          set {position of w, size of w} to {{i * width, 0}, {width, height}}
          set i to i + 1
      end repeat
  end tell

The problem appears to be that the windows given to me by System
Events are identified only by name, not id—I get an error if I ask
`get id of w` in the loop. And the reason that I'm going through
System Events is that I want tiling to work even for non-scriptable
applications.

Is there a way to identify the windows of a non-scriptable application
by id? Or maybe I'm just making a dumb mistake somewhere?

 Dan
 _______________________________________________
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

  • Follow-Ups:
    • Re: System Events: window id's instead of window names?
      • From: Thomas Fischer <email@hidden>
    • Re: System Events: window id's instead of window names?
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: Folder actions and Leopard
  • Next by Date: Re: iCal Recurring events
  • Previous by thread: Re: Folder actions and Leopard
  • Next by thread: Re: System Events: window id's instead of window names?
  • Index(es):
    • Date
    • Thread