Is There a Way to Capture the Name of the Drive That Triggers a "Mounted Volume Trigger"?

Just what's on the tin, or…

I'm dealing with the Big Sur known issue (by everyone but Apple, apparently) of my external drives randomly dropping off.

I've created a KM to email me when any of the four externals drop off. What I'd like is to customize the email to tell me which drive dropped off. I currently receive an email for each, and the redundancy is fine with me, but they're equally === uninformative.

Any way to capture to a variable the name of the drive which triggered the email?

It might help to see the macro that you’re using to trigger the notification.

Thought the description was self-explanatory. Not at my Mac until later, but the workflow is:

TRIGGERS:
If Mounted Volume A disconnects
Or
If Mounted Volume B disconnects
Or
If Mounted Volume C disconnects
Or
If Mounted Volume D disconnects

ACTIONS:
Send Mail Message Action with "send immediately"

That's it. Want to capture to a variable which drive unmounted so I can use it in the email.

If you still need to see the actual macro let me know and I'll post it later. Can't imagine you do.

Ah, I see. I don’t use this functionality in Keyboard Maestro, so I wasn’t sure.

I think what I would do is pretty straightforward, in the body of the macro:

IF » Path Condition » Nothing Exists » /Volumes/A/
THEN » Send email immediately with Subject ‘/Volumes/A’ is missing!

IF » Path Condition » Nothing Exists » /Volumes/B/
THEN » Send email immediately with Subject ‘/Volumes/B’ is missing!

IF » Path Condition » Nothing Exists » /Volumes/C/
THEN » Send email immediately with Subject ‘/Volumes/C’ is missing!

IF » Path Condition » Nothing Exists » /Volumes/D/
THEN » Send email immediately with Subject ‘/Volumes/D’ is missing!

EDIT: for this reply I'm using "partition" and "volume" interchangeably, since OSX handles partitions as mountpoints and calls them Volumes. FYI.

I don't think that survives stress testing. As there are two partitions (which appear as Volumes on the Mac) on each of 2 drives (so, 4 volumes, 2 drives) they always knock offline in pairs as this OS glitch only sets its sights on drives. KM is definitely detecting the individual drives (partitions) disconnecting, and thus sends two emails. The workflow you suggest fails as follows (I think… correct me please)…

  1. Partitions A and B are sent offline together (it's always together)
  2. KM kicks into action and starts processing /Volumes/A/ partition's disconnect and the Path Condition ifs...
  3. IF » Path Condition » Nothing Exists » /Volumes/A/
  4. Partition A is indeed offline so I get my variable set and get sent my email telling me that Partition A is offline. Cool cool cool.
  5. IF » Path Condition » Nothing Exists » /Volumes/B/
  6. Partition B is indeed offline so I get my variable set and get sent my email telling me that Partition B is offline. Cool cool cool.
  7. KM kicks into action (again) and starts processing /Volumes/B/ partition's disconnect and the Path Condition ifs...

See what happens here?

I'd get at least a duplicate email for 2 volumes, and quadruple emails for 4 volumes going offline together.

Unless I'm missing something.

¯\_(ツ)_/¯

Use the token %TriggerValue% to set a variable for your email.

See Mounted Volume trigger:

When the macro executes, its %TriggerValue% token will hold the name of the volume (technically, the last path component, which will sometimes be slightly different to ensure uniqueness by the system).

3 Likes

I knew there would be something at the very base of it all, Peter doesn't spare these details. I just didn't know what to search for.

As for missing it on the info page, which I did review but only by scanning, I can only blame the oxy for my shoulder surgery. That's my story and I'm sticking with it.

(Duh. :roll_eyes:)

Thanks, JM.

3 Likes

Final result:

Thanks all.

1 Like