Re: System Events: window id's instead of window names?
Re: System Events: window id's instead of window names?
- Subject: Re: System Events: window id's instead of window names?
- From: Thomas Fischer <email@hidden>
- Date: Tue, 22 Jun 2010 15:21:08 +0200
Hi Daniel,
I'm not quite clear what you are trying to achieve.
But from short testing, my impression is that "process" windows don't have ids, while application windows do.
So for example
tell application "System Events"
get id of window 2 of application "TextEdit"
end tell
works for me (10.6.4), while
tell application "System Events"
get id of window 2 of process "TextEdit"
end tell
yields an error.
Does this help in any way?
Best
Thomas
Am 22.06.2010 um 01:40 schrieb Daniel Brown:
> 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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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