Using a script to export an illustrator file to .jpg with a specified resolution

I want to export an illustrator file to a .jpg and control the resolution.  I can't figure out how to do it.  I get 72 dpi.
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document, jpgOptions As New Illustrator.ExportOptionsJPEG
jpgOptions.HorizontalScale = 100#
jpgOptions.QualitySetting = 100
jpgOptions.VerticalScale = 100#
appRef.Open ("testfile.eps")
Set documentRef = appRef.Documents("testfile [Converted].eps")
documentRef.Export "testfile.jpg", aiJPEG, jpgOptions

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

drjoeusaAuthor Commented:
I did find a solution that is not very elegant.  I can create an action to do the save in Illustrator.  Then I use 'DoScript' to save the file.  I took out the export line in the sample code and added:
appRef.DoScript "expJPG_CYMK_600", "Default Actions"
Call ShortPause(10#)
If appRef.ActionIsRunning Then
    Call ShortPause(10#)
End If
documentRef.Close aiDoNotSaveChanges
The expJPG_CYMK_600 is the name of the action I recorded.
ShortPause(10#) is a simple VB idle routine for a 10 sec pause to give the action time to complete.  If it isn't complete after 10 seconds, I try another 10 second.  I tried a while appRef.ActionIsRunning loop but got errors.  I'll work on that.

In this case, the file is saved to the default directory and with the default name.  I would prefer to control these but don't know how.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Illustration Software

From novice to tech pro — start learning today.