Call Alfred as a Subroutine

This is a fairly basic set of subroutines, but I'm no wizard, so any thoughts on how to make them more robust are welcome.

Why it might be useful

  • Get results from Alfred's file search as part of your Keyboard Maestro macros.

How it does that…

  • Calls an Alfred workflow (Included) by AppleScript and then waits for it to return its output to Keyboard Maestro.
  • I've also included subroutines to use other features like Universal Actions, File Navigation, and other workflows, by calling them through AppleScript

Why would you do that?

Summary
  • You prefer to keep your triggers and macros mostly in one place (Keyboard Maestro), but want to make use of some Spotlight-based features
  • You haven't got around to making the macro you want in Keyboard Maestro, but someone's made an Alfred Workflow you could use in the meantime
  • You want to use some of Alfred's views as a way to display the output of your macro

Workflow and Macro Group
Workflow (Required) - Send Results to Keyboard Maestro.zip (182.3 KB)
OSX Alfred Macros 0.11.kmmacros (30.5 KB)

Macro Screenshot

Summary


3 Likes

Cool idea. Thanks for sharing these. Two questions:

  1. What is the Script file in the "Browse Alfred with…" macro?

  2. In the "Search Alfred with…" workflow should this:

tell application "Keyboard Maestro Engine" to set kmVariable to getvariable "asVariable"
tell application "com.runningwithcrayons.Alfred"
	search kmVariable
end tell

Be:

tell application "Keyboard Maestro Engine" to set kmVariable to getvariable "asVariable"
tell application id "com.runningwithcrayons.Alfred"
	search kmVariable
end tell

"application id"

Yes, thank you! Whenever I typed “com.runningwithcrayons.Alfred” it kept changing correcting it to “Alfred 5” and maybe that’s why

Browse Alfred just opens the folder in its file navigation. It’s mentioned in the AppleScript dictionary so I made it but I think if you put any any file path into the search subroutine it would do the same

I’ve fixed those two things.

1 Like

Updated macros work great :sunglasses: