Mail's Activity 'window'

As I move between home and work with my laptop I have set up a macro to move my windows to the correct SCREEN at work/home. One item I am having difficulty with is placing the Mail.app ‘Activity’ window. It appears to me like it may not be a true window, but in any case, among other things I have tried:

Activate Mail
Type the ⌘W Keystroke
Type the ⌘W Keystroke (All windows are closed at this point)
Type the ⌥⌘0 Keystroke
Bring Application Windows to Front
Move Front Window to Position
In Mail
To: SCREEN(Main,Left) horizontally, SCREEN(Main,Bottom)-WINDOW(Height) vertically.

and it will not consistently move the window. Any suggestions?

Keyboard Maestro only deals with regular windows generally (except that sheets or palettes may be considered the “Main” window if they have the keyboard focus).

You will need to use AppleScript or some other means to move the window.

Hey There,

Run the first script from the Applescript Editor app to get values for:

{{Position}, {Size}}
{{X, Y}, {Width, Height}}
{{1477, 654}, {443, 542}} # Real values.

Fill the appropriate values in Script 2, and you can run that from a Keyboard Maestro Execute AppleScript Action.

NOTE that AppleScript doesn’t savvy multiple screens per se. It sees them as one big space, so you’ll have to get values for both work and home machines and work with that.

-Chris


AppleScript 1

-------------------------------------
# Get Activity Window Size & Position
-------------------------------------
tell application "System Events"
  tell application process "Mail"
    set frontmost to true
    if (window "Activity" exists) = false then
      click menu item "Activity" of menu 1 of menu bar item "Window" of menu bar 1
    end if
    tell window "Activity"
      set winPosition to position
      set winSize to size
    end tell
  end tell
  return {winPosition} & {winSize}
end tell
-------------------------------------

AppleScript 2

-------------------------------------
# Set Activity Window Size & Position
-------------------------------------
set winPosition to {1477, 654}
set winSize to {443, 542}

tell application "System Events"
  tell application process "Mail"
    set frontmost to true
    if (window "Activity" exists) = false then
      click menu item "Activity" of menu 1 of menu bar item "Window" of menu bar 1
    end if
    tell window "Activity"
      set its position to winPosition
      set its size to winSize
    end tell
  end tell
end tell
-------------------------------------

Thanks for that info

Thanks for the script, I will use it.