Script Editor, the built-in macOS app for creating and dealing with AppleScript and JavaScript automation, comes with a handful of example templates, including this gem for importing files into Aperture:
Aperture was discontinued some eight years ago, but this template is still included in the version of Script Editor bundled with macOS Ventura.