• 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
Re: Mail Activity Window is Front?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail Activity Window is Front?


  • Subject: Re: Mail Activity Window is Front?
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 25 Oct 2015 12:10:14 +0100
  • X_v_e_cd: f01be324fd51df2fc99970cdd81c4dde
  • X_v_r_cd: 07f6d6ef3e5e78e1f226438b595fca04


Le 2015/10/25 à 07:44, Christopher Stone <email@hidden> a écrit :

On Oct 25, 2015, at 01:09, Christopher Stone <email@hidden> wrote:
Certain Keyboard Maestro macros I have for manipulating the UI don't work properly with the changes, and I'll have to try to work around them.  This is a bother but not a big deal.
______________________________________________________________________

Hey Folks,

Okay.  Here's how I worked around the problem.

This keeps focus on the front mail-viewer-window when opening the Activity window, so my Keyboard Maestro macros perform the correct actions.  It closes the Activity window if it's open already.

--
Best Regards,
Chris

--------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/10/25 01:15
# dMod: 2015/10/25 01:30
# Appl: Mail, System Events
# Task: Toggle the Activity Window Open/Closed and bring focus back to the front Mail-Viewer.
# Tags: @Applescript, @Script, @Mail, @System_Events, @Toggle, @Activity, @Window, @Open, @Closed
# Note: Tested only on 10.11.1 with Mail in Classic-View.
--------------------------------------------------------------------------------------

try
  
  tell application "System Events"
    tell application process "Mail"
      set frontmost to true
      if (name of windows) does not contain "Activity" then
        tell menu "Window" of menu bar item "Window" of menu bar 1
          click menu item "Activity"
          click menu item "Message Viewer"
        end tell
      else
        tell window 1
          tell attribute "AXCloseButton"
            click its value
          end tell
        end tell
      end if
    end tell
  end tell
  
on error e number n
  stdErr(e, n, true, true) of me
end try

--------------------------------------------------------------------------------------


Hello

As always, I tried to edit your script so that it's no longer sticked to English.

At first look I assumed that it would be fine to replace the menu items triggering by use of shortcuts.
Alas, the engineers defined the related shortcuts as cmd + option + 0 (yes the zero) and cmd + 0 (zero again).
If my memory is right, they are OK on English system but when I run the system in French, 0 is reached by shift + à.
Given that, I dropped the use of shortcuts and triggered the menu items by their index.

--------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/10/25 01:15
# dMod: 2015/10/25 01:30
# Appl: Mail, System Events
# Task: Toggle the Activity Window Open/Closed and bring focus back to the front Mail-Viewer.
# Tags: @Applescript, @Script, @Mail, @System_Events, @Toggle, @Activity, @Window, @Open, @Closed
# Note: Tested only on 10.11.1 with Mail in Classic-View.
--------------------------------------------------------------------------------------
(path to application "Mail") as «class furl»
set Activity_loc to localized string "5.title" from table "ActivityWindowController" in bundle (result)

try


tell application "System Events"
tell application process "Mail"
set frontmost to true
if (name of windows) does not contain Activity_loc then
(*
# They use awful shortcuts.
# on English system they would be :
keystroke "0" using {command down, option down}
keystroke "0" using {command down}
# On a French system they would be:
keystroke "à" using {shift down, command down, option down}
keystroke "à" using {shift down, command down}
*)
(*
log (get name of menu bar item 9 of menu bar 1)
*)
tell menu 1 of menu bar item 9 of menu bar 1
click menu item Activity_loc
click menu item 9
end tell


else
tell window 1
tell attribute "AXCloseButton"
click its value
end tell
end tell
end if
end tell
end tell


on error e number n
stdErr(e, n, true, true) of me
end try


Yvan KOENIG (VALLAURIS, France) dimanche 25 octobre 2015 12:10:04



 _______________________________________________
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

References: 
 >Mail Activity Window is Front? (From: Christopher Stone <email@hidden>)
 >Re: Mail Activity Window is Front? (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Script Editor phantoms
  • Next by Date: Re: Script Editor phantoms
  • Previous by thread: Re: Mail Activity Window is Front?
  • Next by thread: Script Editor phantoms
  • Index(es):
    • Date
    • Thread