Variable to paste back in file extension when doing a "save as" and renaming a file?

Hi,

I have with some support, created a great macros that lets me automatically download files I need to archive from an electronic health record website. However, due to HIPAA, the files are renamed when downloading to a long string of letters/numbers plus the file extension. So the Save As window will show an original name of (for example)
"39ejfjw2oediudirolekje.jpg" and then KM will paste over this the Filename and ID using variables before downloading. This works beautifully but because the default is that the system has highlighted the entire text including the ".pdf", the extension is lost and after the files are downloaded, I can no longer see what type of file, can't use Preview, and sometimes cannot access the file anymore or get error messages. If I simply add the extension, they work correctly. I have 15K files to download that must be saved for years due to healthcare requirements, and cannot chance having some of them inoperable due to saving without extension.

Can someone please suggest how I can either first save and then paste in the extension when I paste the variables over the string of letters and numbers or capture the file extension from info on the file and add it after downloading? I've attached part of the Macros. It seems like inserting a Variable that is the file extension would make the most sense if I knew how to capture the file extension to begin with.

I'm fairly new to KM but I'm a pretty quick learner. I'll happily share any of the Macros actions if that helps. I'm on Mac with Monterey using Safari. Thank you so much!

Since the entire field is selecting, start the actions with Cut action, then use Split Path action on the %SystemClipboard% to extract the extension in to a variable, and then use that in your replacement text.

That did it! Thank you so much. I was able to fix it. I really appreciate your help.

1 Like