[FILE] Process Lines in Text File

This is very powerful, but hard to understand at first (for most) and tricky to use. :wink:

I have trouble with the Macro
When I try it fresh out of the box, I get an error message:

Action Failed
Read File action failed because source is not a full path obj[7871]: Class FIFindferSync etc. etc.

I just tested this macro again in it is running fine with Keyboard Maestro 8.1.1 (8.1.1) on macOS 10.12.6.

This sounds like you may have selected a non-text file.
After you run the macro, please do this:

  1. Make a screenshot of the actual error msg, and post here.
  2. Open the KM Editor Preferences, and get the value of Variable “myFilePath”, and post here.

Above is the error message.

I was correctly opening a text file. That was not my problem.

I found the "cause".

I was using the Try button in Editing mode to launch the Macro. That a resulted in the error. When I launched the Macro in the conventional way (not in Editing Mode but using the Status Menu), it worked fine.

I appreciate your very prompt response. Sorry for not having figured this out. I did not realize that the Try button could cause trouble in this way.

When launching using the Try button, the value of myFilePath is seen below, in case you are interested,

objc[9358]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff92deeb68) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x113b33cd8). One of the two will be used. Which one is undefined.

The reason it failed when using the Try button was because the Try button only executes the current action, not the whole macro, so the previous actions that the selected action expected to have been run before it was executed had not yet been run (don't worry, you're far from the first one to assume that that button is for the whole macro rather than just the action). In KM8, the button to execute the entire macro is this one, at the top of the editor window:


First of all, I appreciate learning about the Entire Macro Run button and how it differs from the Try button. But if NO action is selected, the Try button seems to run the entire Macro.

So if you leave the Edit mode (click to deactivate the Edit button) and then click it again (activate the Edit button) there is no single Action that is selected. If you hit the Try button at this point, it seems to run the entire Macro. Since I did not understand/appreciate the Entire Macro Run button that you pointed out to me, I would go through this little dance often.

Currently, I still will get the error even if I use the Entire Macro Run button.

The sad thing is that I thought the issue was being in Edit mode. I had had success with invoking the Macro using the Status Menu. But when I retry the whole thing now, I get the error also when I use the Status Menu. I do not know what has "changed". Rarely, it will work. Confounding.

When I run the Macro: [KM]Display Macro Error that JMichaelTX provided to help with debugging, it also throws an error.


So somehow something weird is going on with the state of my Mac in terms of this Macro. Most commonly it fails totally after I select the text file. Sometimes it will work and several windows will open up showing the various lines. Sometimes only the first window will open up showing the first line and then I will get the error. It is all bizarre.

I also get this same error when i run [KM]Display Macro Error
I run it immediately after an error, so i have no clue why. Or at least: it can’t match with the regex…

High sierra 10.3.3
KM 8.1.1

EDIT: Don’t want to go off topic. Just affirming rlivingston isn’t the only one :wink:

I assume you are referring to the macro at the top of this topic:
MACRO: [FILE] Process Lines in Text File

Just to be clear, that button is called "Run Selected Macro"

Please be sure you are selecting a TEXT file with multiple lines in it, like this:


If you get an error, please make a screenshot of it and post here.

OK, I can help with that, but not in this thread. That is a completely different issue. Please post your comments/issues about the Display Macro Error macro in its topic:
MACRO: [KM] Display Macro Error

But for now, to debug your issue with " [FILE] Process Lines in Text File", don't bother with the "Display Macro Error" macro.

Here is the file that I will be using which you suggested. The Macro is running and I am just about to select the file.

Here is the error message that transiently appears in the right upper corner pf the screen

Previously, I have run the Macro with an extra Action inserted by me to capture the value of %myFilePath%

What that Alert box shows is

At the end, you can see the correct Path name for the file that was selected. I do not know the meaning of all the "other stuff"

I could make a screen video of all this if necessary although I do not know hw to upload such a thing to the forum.

Thanks for the correct name of the Run Selected Macro button

Thanks for posting that Alert screenshot. Clearly there is some major issue.
I've never seen such an error.

What versions of KM and macOS are you running?
I'm running Keyboard Maestro 8.1.1 (8.1.1) on macOS 10.12.6.

In a new Macro try this:

Select the file path by clicking on the folder button.

Let us know how that goes.

Sorry for the bug guys. Hopefully this will fix it.
Please update to this new version.

If you search for the “Class FIFinderSyncExtensionHost is implemented in both” issue on the net you'll find a bunch of references to it - basically this is an Apple issue, and the result is that when running an AppleScript, the system is pointlessly complaining about this issue, and that complaint is being returned from this action:

The solution here is to turn off the option to include errors in the gear menu for that action. Well, the solution is for Apple not to pollute the world with their errors, and to fix the errors like this when they happen, but that is somewhat beyond out control.

1 Like

KM 8.1.1
Mac 10.13.3

In a new Macro try this:

Select the file path by clicking on the folder button.

Let us know how that goes.

Works fine. I see the contents of the file.

Peter the Elder’s suggestion to turn off Include Errors works and the Macro now functions properly.

Thanks to all for the help with this.

1 Like

Don’t know why, I just can’t process this macro through. But earlier days it was totally ok.

I got the following message using this Macro :point_right: Display Last KM Macro Error - Macro Library - Keyboard Maestro Discourse

/Users/as/Downloads/111 copy 2.txt

2018-04-02 20:31:09 Read File action failed because source is not a full path objc[15833]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fffad677b68) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x10e4f5cd8). One of the two will be used. Which one is undefined.

/Users/as/Downloads/111 copy 2.txt In macro “[FILE] Process Lines in Text File” (while executing Read File to Variable “myLines”).

I think that is the same error, and has the same fix as above.
Please make sure the "Include Errors" option in the Gear menu is UNCHECKED in the "SCRIPT: Get Last Error Made to KM Log [JXA]" Action:


@JMichaelTX Thank you! Sorry for not going throgh the post before.

1 Like

A post was split to a new topic: Open Files Using Paths Copied to the Clipboard

Sorry to bump this old conversation, but I am utilizing the 'Process Lines in Text File' macro from @JMichaelTX and I have a question about it. Is there a way to have a text file live on the desktop and execute the macro without being asked every time which text file to use. For example, In the third action 'Read File to Variable 'myLines' I clicked the folder icon and navigated to the text file on the desktop. I was hoping I could then run the macro without being asked where that file is again.

Yep, very easy.

  1. Disable/Delete the AppleScript Action that prompts you for the file.
  2. Change the "Read File" action to enter the direct path to your file:


Then every time you run the Macro it will used the fixed file path.

That did it! Thanks so much.

1 Like