Exporting to JPEG from script seems to give less size/resolution information than exporting from AI itself.
This manifests itself when opening in Microsoft Word, when the 'from AI' JPEG appears correctly sized, whereas the 'from script' JPEG just fills whatever page size you've specified.
Does the 'from AI' JPEG have more metadata compared to the 'from script' JPEG? This is what it looks like when I look at the files using Exiftool.
Does 'from AI' have EXIF data, maybe as well as JFIF? Does 'from script' only have JFIF? And Word is only looking at the EXIF data?
Can I get EXIF into the exports?
your quality issues may just be the script is using the default quality setting
The quality of the exported image. Range: 0 to 100. Default: 30
not so sure about the scaling issue
but I believe EXIF comes from your camera where as JFIF is the standard from most software.
I could be wrong in this.