How Do I Copy an Email Link from the Postbox Email Client to a Fantastical 2 Event?

Keyboard Maestro Postbox to Fantastical 2

Thanks to @vincent_ardern and @ccstone for pointing out my lack of information and surfacing links on how to correctly format a post. I was not aware of these links; they are extremely helpful. I appreciate your time and patients with a new member of the community. So, lets try this again.

KM Version: 8.2.4
macOS version: 10.13.6

End goal: I would like to copy an email message link from the Postbox mail client and then create an event in Fantastical 2 that includes that email message link.

Process:

  1. The macro places the cursor on the screen (by finding an image) and then right clicks and selects "copy message link."
  2. Set a variable (messageLink) to the clipboard text.
  3. Prompt user for text of the calendar event and place the user input in variable (eventSyntax).
  4. Activate Fantastical
  5. Open create new calendar event input window (via simulated keyboard shortcut).
  6. Set system clipboard to the calendar event syntax (via the variable eventSyntax)
  7. Paste the clipboard to the Fantastical new event input window
  8. The macro places the cursor on the screen (by finding an image) and uses simulated keyboard presses to locate the URL field.
  9. Set system clipboard to the message url (using the messageLink variable)
  10. Paste the message link into the Fantastical 2 event input window URL field
  11. Use keyboard simulation to finalize the calendar event

Failure point: The Macro runs without error. However, it either fails to past the message URL in the URL field in Fantastical 2 or places old clipboard text. The expected result is that the the correct message link (copied) earlier is pasted in the URL field in Fantastical 2.

Encoded URL Looks like this when directly copy and pasted: x-postbox-message://SANEBOX.ATTACH.DM5PR0101MB30843A6435C51DDB1EC4D26789260%40DM5PR0101MB3084.prod.exchangelabs.com

I am grateful to any suggestions on how to make this work—including different (and better) ways to automate this process.

Postbox Mail client to Fantastical 2

Prompt for User Input.kmactions (837 B)

1 Like

@bradley, since your post is really a new subject, I have moved it to a new forum topic.

On a second re-reading of your OP, I realize they are probably the same subject.
But your new post explains your request much, much better.
So, it is still probably worth a new topic.

Good luck.

1 Like

After little success with the above macro, I have simplified it a ton by just using AppleScript. I simply have KM trigger and run the AppleScript with a keyboard shortcut. The script is below in case anyone else has the need described in my OP above. The script first gets the URL of the email message from Postbox and then asks the user for the event string. Then it, creates a new event in Fantastical 2 using the user input and fills in the notes field with the message URL.

--Getting the Message URL from PostBox email client--
tell application "Postbox"
   set emailMessage to item 1 of (get selection)
   set messageURL to URL of emailMessage
end tell

--Getting input from user containing event they wish to schedule and setting the input to the variable called eventSyntax--
set userInput to display dialog "What is the event you would like to schedule?" default answer ""
set eventSyntax to text returned of userInput

--Paste the user data into fantastical 2--
tell application "Fantastical 2"
   --The "add immediately command executes the passage of information with no interaction from the user--
   parse sentence eventSyntax notes messageURL with add immediately	
end tell