Email and Trash a File?

I am trying to create a workflow whereby after I export a Pages document to docx, it will be attached and email using Spark app. After the files is sent, I want it to be trashed.

Trash is not working, what am I doing wrong?

I just realizes that the whole trash action is wrong as other PDF files are being deleted.

Keyboard Maestro Actions.kmactions (6.7 KB)

Hey @slyfox,

It's a bit hard to tell without testing but it looks to me as if you have the trash action out of context.

As far as I can see you're NOT sending the email to begin with.

Then the macro expects Spark to NOT be in front for the trash action to take place.

So it seems to me that you need to have a means to detect whether all your emails have been sent and to trigger the delete action after that condition clears.

If that condition is for Spark to no longer be frontmost then you probably need a separate macro with an application trigger.

I don't know about Spark, but Mail would be quite unhappy if I deleted my file attachment before it got sent.

-Chris

What I am trying to do here is have the Spark compose window with all the info filled in and the file attached. I want to manually click send.

Once the email is sent, Spark window is not at the front anymore. Right after this happens, I want KM to delete the file.

Spark changes its window title to match the subject – so you need to record that title to a variable once it's stable.

Then you should be able to use a Pause Until Action to wait until the focussed window title changes to delete your file.

That should get you going, but holler if you get stuck.

-Chris

Pause until fixed the workflow problem! Thank you Chris.

Do you think that this workflow is best achieved with KM or Hazel? I don't think that I would be able to set the subject like and email to in Hazel for Spark.

Definitely a job for Keyboard Maestro.

-Chris