With one of my other hats on, I direct local track meets. We’ve been forced to switch to horrible Windows software called HyTek Meet Manager because it should be more reliable than a terrible Adobe AIR package called MeetPro that we were using. Long story short, this app creates some text files (times) that I need to concatenate (so I can match them up with finishers). Here’s the workflow I’m looking to create:
- Select 1 or more files (usually between 2 and 20) and either click a Keyboard Maestro palette icon or drop them all on an Automator droplet in the Finder window’s toolbar.
- Potentially sort them by date created (they have weird names, like 001-0009.tm2 and 002-0010.tm2, and I don’t yet know if they’ll sort properly by name or not)
- Combine them all together into one file using the sorted order (Unix cat, or Automator Combine Text Files after some renaming)
- Replace any double line breaks with single line breaks (/r/r with /r)
- Change the line endings to CR/LF for Windows.
- Prompt for a new name for the combined file, making sure to save it with a .tm2 extension.
- Save the file in the same (Windows) directory as the originals. I’m using Parallels, so it’s mounting C: in Windows via SMB and it seems I can work with it in the Finder.
I’ve been able to get pretty close to this with Automator by renaming files to .txt, combining them with Combine Text Files and saving with New Text File, and renaming the output file again. But where I’m bogging down is that BBEdit’s Automator actions let me open the file, get its contents, do the grep search, and set the contents, but I can’t figure out any way in Automator to save and close the document that’s open in BBEdit.
I thought about doing it in Keyboard Maestro and a BBEdit text factory, but KM isn’t as good at working on selected files.
The real solution is probably a shell script invoked from either Automator or KM, but I really suck at shell scripts. It would probably take me an hour of fighting with how to pass variables and the like to get it working. So, if someone out there like @ccstone or @frederico or @peternlewis has a snippet I could try, I’d appreciate it!