Re: Yosemite and activate failures
Re: Yosemite and activate failures
- Subject: Re: Yosemite and activate failures
- From: Deivy Petrescu <email@hidden>
- Date: Thu, 15 Jan 2015 18:22:23 -0500
- Sun-java-system-smtp-warning: Lines longer than SMTP allows found and truncated.
> On Jan 15, 2015, at 16:15 , Ray Robertson <email@hidden> wrote:
>
> On Jan 15, 2015, at 3:06 PM, Yvan KOENIG <email@hidden> wrote:
>
>> What I described as the correct result is in fact :
>> <snip>
>> So, It's not the normal one.
>
> Thanks for testing. I should add: I’m often getting different results when running the original script with the “activate” command. I’ve yet to see a pattern behind the behavior. I just know in almost all cases the result is wrong.
>
>> My understanding is that as it has so graphical interface, the script's process is not seen as the frontmost one.
>
> I have not heard that anything app without a GUI would not be seen as frontmost. Regardless, it seems as if System Events is able to ensure an application is frontmost. But under Yosemite we can no longer rely upon “activate” in applets. Anyone using GUI scripting in an applet should take note, though this will also affect some scripts using pure AppleScript as well.
>
> Ray
> _______________________________________________
Ray, it is working as expected, it is just running faster (or slower) than before (if it used to work).
Try this script and you will see that it is running correctly
<script>
set appNameReportText to ""
tell application "Finder" to activate
say "a"
set appNameReportText to appNameReportText & getFrontmostAppName() & return
tell application "Mail" to activate
say "b"
set appNameReportText to appNameReportText & getFrontmostAppName() & return
tell current application to activate
say "c"
set appNameReportText to appNameReportText & getFrontmostAppName() & return
display dialog appNameReportText
on getFrontmostAppName()
tell application "System Events" to return item 1 of (get name of processes whose frontmost is true)
end getFrontmostAppName
</script>
Now, what Yvan said was not normal it is in fact normal, run the following script:
<script>
set appNameReportText to ""
tell application "Finder" to activate
set appNameReportText to appNameReportText & getFrontmostAppName() & return
say "a"
tell application "Mail" to activate
set appNameReportText to appNameReportText & getFrontmostAppName() & return
say "b"
tell current application to activate
set appNameReportText to appNameReportText & getFrontmostAppName() & return
say "c"
display dialog appNameReportText
on getFrontmostAppName()
tell application "System Events" to return item 1 of (get name of processes whose frontmost is true)
end getFrontmostAppName
</script>
The difference is that the first application that is front most when you click run script is Script Editor.
so, the test to do is run this script timing every step both in Mavericks and Yosemite and see the difference.
Deivy Petrescu
email@hidden
_______________________________________________
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