I wrote a macro to process (open a URL link in the email, etc) a specific type of email containing the term 'POEM:' at the beginning of the subject line (POEM is a technical acronym; I am not a poet). Please note that the text following POEM: in the subject line varies with each email I have to process.
The macro works fine if I open apple mail and highlight the email in question.
I would like to add the following instructions to the beginning of the macro:
activate apple mail (no problem, I know the action)
go to the the inbox, search for and highlight the email whose subject starts with POEM: (there will be only one such email at any one time).
open that email (just type return which I know how to do in a macro).
If you're using Apple Mail, the best way to go about something like this is to use AppleScript:
tell application "Mail"
activate
open (get first message of inbox whose subject begins with "POEM")
end tell
This one script used in an Execute an AppleScript action can replace every action you describe in your post by itself. However, you can also do much more. As a simple example, this Execute an AppleScript action will create a KM variable with the entire body/text of the email:
tell application "Mail"
return content of (get first message of inbox whose subject begins with "POEM")
end tell
Which from there can of course be processed in the same way as any KM variable.
If the rest of your macro works for you and you'd rather not mess with it beyond this step, I understand perfectly, but in case you're willing and able to share the entire workflow you'd like to accomplish, I'm sure that someone here could help you figure out a more efficient and accurate way of doing so.
@ronald, since your OP has been answered/solved, I am going to move the remainder of the discussion to a new topic, since it is a very different subject.