I'm writing a script that we will be using for sending jpeg proofs to customers, and have run into a slight problem with certain types of filenames.

The export command from illustrator (in applescript) doesn't return a value, so, if you:



export front document to file (savePath) as JPEG



you have to assume that someFile.ai is going to be someFile.jpg. That doesn't always work, like when you have a space in the filename. "some file.ai" becomes "some-file.jpg"

I know I could just find/replace all spaces in the filename with dashes, but how do I know what other characters might change?

any ideas?