Hi there. New user of KM here, and love it so far.
I want to set a macro that creates a new email in my gmail web interface (chrome browser in catalina btw), then inserts a specified subject line and body text.
I searched for a while in here and i found this great "# Task: Bring Chrome Tab with Gmail to front if it exists - otherwise open Gmail in new window a. # : Then open a compose panel." script from @ccstone (thank you, chris) it only goes as far as opening a blank compose window.
Oh my god, thank you so much. yes it seems to be a bug of some kind. There was no 'New Action' button after the script window, but shutting KM down and restarting it fixed that and now it works!!! Can't believe i didn't try turning it off and on again myself.. really should have learned by now.
If anyone else stumbles across this, I now have it working and I'm attaching the macro here for you to edit and use.
Uses @ccstone script to detect whether gmail is open or not, and to open a new compose tab
Pauses for 1 second
Tab to subect line
Pauses for 1 second
Inserts your defined subject line
Pauses for 1 second
Tab to email body
Pauses for 1 second
Inserts your defined email body text
I tinkered around with the pause intervals but found if they are too short the commands run into each other and you end up with stuff like the body text being pasted into the subject line etc, but 1 second intervals seem to work just fine.
If you get this happening again, and most especially if you can figure out duplicating it, please let me know.
For a normal Mac app, sequences of typing should not generally need pauses. However when changing focus (application, windows, etc), that's where Pauses are typically needed.
But web apps, that's a whole different kettle of fish, even straight typing in to a field can result in out of order characters if the app behaves poorly.
actually i can replicate it. maybe it's something i'm doing wrong?
When I create a new test macro and choose 'Execute AppleScript', then paste in the script.. there's no option following that to add a new action. See here for an example I made 2 mins ago.
Here'a script I use u=in Gmail for repetitive 'release' emails on a project. '
I manually open the blank email and make sure the cursor in in the "to" field.
it firsts puts three email addresses into the "to" field
shift-command-C then moves the cursor to the "CC:" field (a gmail keystroke)
it then enters two more email addresses into CC field
it then tabs into the subject field and enters my text
it then tabs into the body of the email to enter some boilerplate text.
I like to hear a pop after each entry. Also have some pauses included from having written this about a decade ago. Might still need them when gmail is on a slow connection. Perhaps not.
Just run the subject and body through the Filter Text With Percent Encode for URL before constructing the URL, then open in your browser. Much more reliable (and faster) than pausing and tabbing and pasting.
The Gmail compose URL method has been great this past week. They offer a few more esoteric formats too but I've only needed the one you shared, Gabriel. For my setup, it's faster than macro'ing a native Mail.app compose.
I run this macro, copy an email and a name, and Gmail compose opens. Some plain text prefills, below which I paste a rich text signature.