I'm trying to write an applescript that creates a new Mail message when i press command shift M.
I have set up a new applescript service that creates new mail message. when it does this though, it starts both the inbox and then on top of that the new mail message (if i close mail inbox it works fine, but i also hide mail a lot and thats when it happens)
due to my job i create a LOT of emails a day and ideally I'd like to have it show only the new mail window so that when i send it, i can go back to whatever I was doing before i started it. i am not good at applescript and i have tried googling for a few hours now to no avail... this is about the closest I got but it still is far from working. like is aid it wokrs fine if i close mail with command w but a lot of times i also use command H because its a hotkey on my house
I have set up a new applescript service that creates new mail message. when it does this though, it starts both the inbox and then on top of that the new mail message (if i close mail inbox it works fine, but i also hide mail a lot and thats when it happens)
due to my job i create a LOT of emails a day and ideally I'd like to have it show only the new mail window so that when i send it, i can go back to whatever I was doing before i started it. i am not good at applescript and i have tried googling for a few hours now to no avail... this is about the closest I got but it still is far from working. like is aid it wokrs fine if i close mail with command w but a lot of times i also use command H because its a hotkey on my house
Code:
on run {input, parameters}
tell application "System Events"
tell process "Mail"
set focused of back window to true
end tell
end tell
tell application "System Events" to keystroke "w" using {command down}
return input
end run