Jump to content

Alfred Maestro - Keyboard Maestro Integration For Alfred


Recommended Posts

Alfred Maestro

Possibly the last workflow you will ever need for system tasks

 

I recently started using Keyboard Maestro (KM), and so far I love it. So I made this workflow to allow you to execute any KM macro straight from Alfred. 

 

screen.png

 

Downloads

- My Site: http://iansinnott.com/blog/integrating-alfred-and-keyboard-maestro/

- GitHub: https://github.com/iansinnott/keyboard-maestro-alfred

 

Basic Usage

Type 'km' followed by the name of the macro you want to trigger. 

 

Dependencies

 

Keyboard Maestro

 

More Info

Check out the readme in my Github repo linked above. Also, check out my blog post about these two apps if your interested in how I actually use it. That's also linked above as the first download link. 

 

Quick Note: I only tested this on the latest version of php (5.5.5 as of this writing). This is not the standard installed version that comes with new Macs, so if you have any trouble with the workflow let me know. 

 

Cheers,

Ian

Edited by ian_989
Link to comment

What parts of php are you using? I can't remember everything that comes compiled into the native php5-cli binary (5.3 pre-Mavericks and 5.4 Mavericks).

 

It looks like the 5.4 on Mavericks has curl, openssl, bzip, zip, gzip, mysql, mysqlnd, mysqli, sasl, soap, pcre-regex, and libxml among other things, and I think that the old 5.3 had a similar recipe (although I'd have to find a machine running that in order to check), so it probably doesn't have to do anything with that.

 

Other possibilities: need to turn on accessibility for KM (I really hate how Apple re-did this for Mavericks). Deprecated php functions that are throwing errors rather than just warnings.

 

Just some thoughts...

Link to comment

I just updated the workflow. I updated it at both of the links in my original post, so just re-download it from wherever you did the first time if you were having trouble. 

 

@raguay.customct, I think the update may solve your problem.

 

Hey @rspike12, that's strange as it is indeed supposed to show all macros by simply typing in 'km'. It does on my system, and now that I just fixed a compatibility issue I don't think it's that either. Maybe an alfred specific setting? If you open up the script filter window make sure that 'with space' is checked after the keyword box and then the dropdown is set to 'argument optional'. 

Link to comment
  • 2 weeks later...

I'm on Mavericks with php 5.4.17.  Getting the dreaded XML Parse Error:

 

Alfred 2[8622]: [ERROR] Script XML Parse Error occured Error Domain=NSXMLParserErrorDomain Code=4 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)" UserInfo=0x618000266740 {NSXMLParserErrorColumn=1, NSXMLParserErrorLineNumber=1, NSXMLParserErrorMessage=Document is empty
}
Link to comment

Bummer. Seeing the same error on Mavericks when triggering the macro. PHP 5.4.17, Alfred 2.1.1:

 

 

12/4/13 5:55:17.479 PM Alfred 2[378]: [ERROR] Script XML Parse Error occured Error Domain=NSXMLParserErrorDomain Code=4 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)" UserInfo=0x60000027f500 {NSXMLParserErrorColumn=1, NSXMLParserErrorLineNumber=1, NSXMLParserErrorMessage=Document is empty

}
Link to comment

Hey, thanks for the feedback. Glad to hear it's working for many of you. 

 

@macdrifter Thanks for opening an issue on GitHub, that brought this to my attention. 

 

For anyone with this 'XML parse error' issue try reinstalling and giving it another go. I wasn't able to find anything too specific about this issue, other than the fact that it manifests in other workflows as well. I'm hoping the update I just pushed will solve the issue for this particular workflow. Make sure to download it from GitHub, as I haven't updated the link on my own site yet: 

 

Updated Workflow: https://github.com/iansinnott/alfred-maestro

Link to comment
  • 3 months later...
  • 11 months later...

Hey, thanks for the feedback. Glad to hear it's working for many of you. 

 

@macdrifter Thanks for opening an issue on GitHub, that brought this to my attention. 

 

For anyone with this 'XML parse error' issue try reinstalling and giving it another go. I wasn't able to find anything too specific about this issue, other than the fact that it manifests in other workflows as well. I'm hoping the update I just pushed will solve the issue for this particular workflow. Make sure to download it from GitHub, as I haven't updated the link on my own site yet: 

 

Updated Workflow: https://github.com/iansinnott/alfred-maestro

The usual cause of such an error message is some part of your code sending output to STDOUT (usually an errant echo/print statement). That output gets mixed in with the XML, making it invalid.

(That's assuming your using a proper XML library to generate the output, not generating it in your own code.)

Edited by deanishe
Link to comment
  • 4 weeks later...

Hi,

 

Thank you for this workflow. I'm just starting out with both Alfred and Keyboard Maestro.

 

The workflow was not showing any KM macros when typing 'km'.. I ended up having to comment out your argv check, and it is working how I think it should, showing all KM Macros when typing 'km' in Alfred.

 

Just commented out the two lines here:

https://github.com/iansinnott/alfred-maestro/blob/master/main.php#L34-L35

 

With the control flow as it was, it was exiting there.. so there was no chance for the list to populate by reaching the 'else' case at the end of the script.

 

 

 

-

Link to comment
  • 5 months later...

If you replace code: 

 

  $macros[] = $macro;

 

with 

 

if (strpos($macro['name'], 'alfredhide') === false) 
{
   $macros[] = $macro;
}
 
Then you can hide macros from being displayed on alfred if you add "alfredhide" to their names. Useful if you have macros that are executed only from within other macros. 
 
Cheers
Link to comment
  • 8 months later...
  • 3 months later...
  • 3 years later...

This one was really important to me. When I upgraded to Catalina, it broke for me with a warning about malicious code or something. I figured it was a Catalina permissions problem of some kind. Here's what I did to fix it:

 

1. Cloned the git repository at https://github.com/iansinnott/alfred-maestro

2. I had to install go, which I did based on these instructions: https://golang.org/doc/install?download=go1.13.1.darwin-amd64.pkg

3. Following the instructions to build Alfred-maestro, I ran "make pack" in the Alfred-maestro directory.

4. Didn't work. Futzing around, I found that, in the Makefile, Alfred-maestro was to be copied into the workflow directory, but the build created alfred-maestro-master. So I changed line 8 of the Makefile to read: 

 

    @mv alfred-maestro-master workflow/alfred-maestro

 

5. Ran "make pack" again and it completed successfully.

6. Installed my new Alfred-Maestro.alfredworkflow. 

7. It worked! 
 

I did all this in terminal. 

 

Took me just a few minutes and now I am a happy user of Alfred-Maestro again.

 

I have not seen this issue with other Alfred workflows I use regularly. 

Link to comment
14 hours ago, tbrown said:

This one was really important to me. When I upgraded to Catalina, it broke for me with a warning about malicious code or something. I figured it was a Catalina permissions problem of some kind. Here's what I did to fix it:

 

1. Cloned the git repository at https://github.com/iansinnott/alfred-maestro

2. I had to install go, which I did based on these instructions: https://golang.org/doc/install?download=go1.13.1.darwin-amd64.pkg

3. Following the instructions to build Alfred-maestro, I ran "make pack" in the Alfred-maestro directory.

4. Didn't work. Futzing around, I found that, in the Makefile, Alfred-maestro was to be copied into the workflow directory, but the build created alfred-maestro-master. So I changed line 8 of the Makefile to read: 

 

    @mv alfred-maestro-master workflow/alfred-maestro

 

5. Ran "make pack" again and it completed successfully.

6. Installed my new Alfred-Maestro.alfredworkflow. 

7. It worked! 
 

I did all this in terminal. 

 

Took me just a few minutes and now I am a happy user of Alfred-Maestro again.

 

I have not seen this issue with other Alfred workflows I use regularly. 

 

Thanks. Would you mind sharing the finished workflow? 🙂 

Link to comment

My suspicion is that the workflow I created and use will still fail on your machine, since it is still not signed by an Apple developer. I think it only works for me because I created it locally and I can write and manage and execute scripts on my own machine without Apple caring--hence the instructions for building on your local machine.

 

I also am uncertain as to whether it is proper for me to share the modified workflow here.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...