I have been using the "Open with" action to cause a specific application to open a file. This filename is passed to my KM macro via Applescript, some prep work in the application occurs, then the file is imported by the application. This workflow has worked for a couple of years, but I noticed it stopped and the KM Engine log reports
2021-06-12 17:13:31 Open File failed with non-existent path “%TriggerValue%”.. Macro “Import OFX file into Personal Moneywell document” cancelled (while executing Open “%TriggerValue%”).
Thanks to this thread Passing %TriggerValue% to shell script I was able to come up with a workaround using a local variable and shell script (below). This new method is a bit more rickety as the only reason it works is that I have manually associated OFX files with the Moneywell application.
I like the old "Open with" because I can specify the application. Did the Open action change the way it does business? Is there a better solution that does not rely on the OS-based file association? TIA!
Hey Paul,
Nothing should have changed on the Keyboard Maestro side.
I do recommend that people never assemble paths inside actions that require them.
Always assemble your path or other values in a variable, so you can easily eyeball and debug the result – then use the single variable in the action that needs it.
AMDE (Always Make Debugging Easy)...
The Execute a Shell Script method is not fragile at all if you know how to use it.
open -a MoneyWell "$YourPathVariable"
OR
open -b <MoneyWellBundleID> "$YourPathVariable"
Can you provide the actual value for %TriggerValue%
?
-Chris
Thanks for the reply, @ccstone. The value of &TriggerValue% is file:///Users/paul/Action/msmoneyExport-16.OFX
. This is passed in from a Hazel action.
I see your point about the open
command. I had not looked at the man page before, but it is much more flexible than I had imagined!
I can certainly use a shell script with the open
command, but I'm still curious why, after more than a year of using the KM "Open with" action, it now fails
Hey Paul,
It looks like you're trying to use a file-url as a file reference.
You've changed the title of the action, so I can't tell from the posted image.
If you use an Open a URL action it should work.
-Chris