Re: strange behavior setting window index to 1 in Safari
Re: strange behavior setting window index to 1 in Safari
- Subject: Re: strange behavior setting window index to 1 in Safari
- From: David Gregg <email@hidden>
- Date: Sat, 04 Jun 2016 15:37:54 -0600
> On Jun 4, 2016, at 3:19 PM, Christopher Stone <email@hidden> wrote:
>
> On Jun 04, 2016, at 12:56, Mitchell L Model <email@hidden> wrote:
>> tell application "Safari"
>> set the index of window 2 to 1
>> end tell
>>
>> brings the second window to the front but leaves focus in the previously front window.
> ______________________________________________________________________
>
> Hey Mitchell,
>
> This is an infuriating long-term bug in OSX (since Mountain Lion if memory serves).
>
> It affects more apps than just Safari.
>
> ------------------------------------------------------------
> set windowIndexNum to 2
>
> tell application "System Events"
> tell application process "Safari"
> set winList to (windows whose subrole is "AXStandardWindow")
> tell item windowIndexNum of winList
> perform action "AXRaise"
> end tell
> end tell
> end tell
> ------------------------------------------------------------
Here is another method that I find works quite well in many of the resistant apps.
set windowIndexNum to 2
tell application "System Events"
tell application process "Safari"
set frontmost to true
delay 1
set value of attribute "AXMain" of window windowIndexNum to true
end tell
end tell
_______________________________________________
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