Help - Pushover Notification with KM Makro/Plugin or Hazel 4/Script

A friendly hello :nerd_face:

I have created a macro that monitors a folder in which a snapshot of the integrated FaceTime camera is saved after every login process on the Mac. If this is the case, the snapshot is sent to my iDevices via a pushover notification. The plugin to Pushover was nicely downloaded from here

and here posted

Here is an example from my workflow:

2019_08_05_Support_KM

My problem is that I don't know what actions I need so that only the current image and not all the existing ones in the folder are sent.

Here is my macro:

iMac login.kmmacros (50,5 KB)
iMac%20login

With Hazel 4 there is the possibility to solve this problem, but I can only do it with a Mail/AppleScript. This means that you can interrupt the background mail action.

I found a script on the internet that allows you to attach a picture from Pushover 3.0 on. However, I only get the file path of the image:

2019_08_05_Support_Hazel_

#!/bin/sh -e
curl -s
-F "token=aoxxxxxxxxxxxxxxxx5"
-F "user=uxxxxxxxxxxxxxxxxxyrq"
-F "title=${1##*/}"
-F "message=iMac Login
Date: $(date '+%Y.%m.%d / Time: %H:%M')
-F "attachment=@Nachricht.png"
$1
"
https://api.pushover.net/1/messages.json

Since I would like to use this via the script in Hazel 4, my question is whether anyone would know a solution here? @kvanh or @jon123?

Hi,

Where is your "Nachricht.png" file? The path should probably be in this form:

@/Users/UserName/Desktop/Nachricht.png

1 Like

Thanks @carycrusiau for the tip. I have entered the path, but get an error message.

If that doesn't work, it's not so bad either, because I can do it very well with KM's folder monitoring.

Can you tell me if I can improve the Macro folder (here iLock)? I don't know much about the variables, etc.

https://cl.ly/99da13

iMac iLock.kmmacros (21,7 KB)
13)iMac%20iLock

Instead of the “For Each” with “%Variable%Image%”, just use the trigger value token: %TriggerValue%.

Example:

This returns the path of the added file.

1 Like

Thanks @Tom for your info :+1: I will try it and get back to you.

Many thanks @Tom for your help :+1: It is exactly what I was looking for.

So I can easily access the existing Pushover KM plugin and customize it.
You will save me some Hazel rules :hugs: