I had a bit of time this morning, and this looked like an intriguing project, so I took a look at the macro: It seemed like there was a lot going on that you could skip, with some changes to the code.
Caution: I used an AI to help modify the Python script to handle things differently. Use at your own risk, but it seems to work for me in testing with the one .sdlxiff file I could find on the entire web for testing!
Extract source document from selected SDLXLIFF - modified.kmmacros (5.7 KB)
This modified version is much simpler. It runs on whatever file (or files, it should work on more than one at a time, but I can't test that) you have selected, regardless of where they're located. It writes the extracted file back to that same location.
It doesn't require any temporary files or folders, and it doesn't require running Terminal as an app. Instead, the Python script is embedded in Keyboard Maestro and called directly. The script is modified to use the path and file as passed in Keyboard Maestro variables.
NOTE: You may have to change the first line of the script:
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3 -c $'
Do which python3
in Terminal, and that's the path you'll want to use. Make sure you leave the ending single quote in place, though!
With these changes, the entire macro is two actions in a Finder Selection loop, and that's it. It seems to work in my testing, but I'd be interested to know if it works for you, given you probably have more than one file you could test it with :).
PLEASE test on a copy of your files, just in case it does some Really Bad Things.
-rob.