Script help for a beginner

I thought instead of asking for corrections on the poorly written code I’ve put together, I’d just start fresh and ask if anyone would suggest a script for me. I believe this is a rather simple script, but it seems beyond my reach at this point.

I have a couple thousand jpg files that I want to rename. They are currently named like “ABC 20021103a,jpg”. I’d like to cut off the front and back to leave on the date and single letter, ie: “20021103a”. In all cases, the formating is consistent. There is always three letters and a space preceding the date. There is always a trailing letter plus “.jpg”

If you would like from extra credit on this project, I’d like to have a script that would rename the new files for me in the format of “YYYYMMDD-HHMMSS”.

Thanks for any input you have!

Best … Ronnie

Jonathan Nathan has created an AppleScript Studio app that does every thing you are asking and does it very well…