Save as" does different thing than "Save for web" beside the 72 dpi. I can manually change the photo to 72 dpi, the resulting JPEG is still different AND is much smaller (the original dpi is 300 dpi).
The reason that I need to do the programming is to figure out the height and width to resize do. It is different for each file. Also the resulting file name is different based on some rules.
In any case, here is an url for the "Save for web" scripting in Javascript,
Based on that, here is the VB version that I wrote.
strFileOut = "c:\file.jpg" 'Your file name here
Dim desc3 As New Photoshop.ActionDescriptor
Dim desc4 As New Photoshop.ActionDescriptor
Dim list1 As New Photoshop.ActionList
desc4.PutEnumerated mPhotoshop.CharIDToTypeID("Op "), _
mPhotoshop.CharIDToTypeID("SWOp"), _
mPhotoshop.CharIDToTypeID("OpSa")
desc4.PutEnumerated mPhotoshop.CharIDToTypeID("Fmt "), _
mPhotoshop.CharIDToTypeID("IRFm"), _
mPhotoshop.CharIDToTypeID("JPEG")
desc4.PutEnumerated mPhotoshop.CharIDToTypeID("Op "), _
mPhotoshop.CharIDToTypeID("SWOp"), _
mPhotoshop.CharIDToTypeID("OpSa")
desc4.PutBoolean mPhotoshop.CharIDToTypeID("Intr"), False
desc4.PutInteger mPhotoshop.CharIDToTypeID("Qlty"), iQuality * 10
desc4.PutInteger mPhotoshop.CharIDToTypeID("QChS"), 0
desc4.PutInteger mPhotoshop.CharIDToTypeID("QCUI"), 0
desc4.PutBoolean mPhotoshop.CharIDToTypeID("QChT"), False
desc4.PutBoolean mPhotoshop.CharIDToTypeID("QChV"), False
desc4.PutBoolean mPhotoshop.CharIDToTypeID("Optm"), True
desc4.PutInteger mPhotoshop.CharIDToTypeID("Pass"), 1
desc4.PutDouble mPhotoshop.CharIDToTypeID("blur"), 0#
desc4.PutBoolean mPhotoshop.CharIDToTypeID("EICC"), False
desc4.PutBoolean mPhotoshop.CharIDToTypeID("Mtt "), True
desc4.PutInteger mPhotoshop.CharIDToTypeID("MttR"), 255
desc4.PutInteger mPhotoshop.CharIDToTypeID("MttG"), 255
desc4.PutInteger mPhotoshop.CharIDToTypeID("MttB"), 255
desc4.PutBoolean mPhotoshop.CharIDToTypeID("SHTM"), False
desc4.PutBoolean mPhotoshop.CharIDToTypeID("SImg"), True
desc4.PutBoolean mPhotoshop.CharIDToTypeID("SSSO"), False
desc4.PutList mPhotoshop.CharIDToTypeID("SSLt"), list1
desc4.PutBoolean mPhotoshop.CharIDToTypeID("DIDr"), False
desc4.PutPath mPhotoshop.CharIDToTypeID("In "), strFileOut
desc3.PutObject mPhotoshop.CharIDToTypeID("Usng"), _
mPhotoshop.StringIDToTypeID("SaveForWeb"), _
desc4
mPhotoshop.ExecuteAction mPhotoshop.CharIDToTypeID("Expr"), _
desc3, psDisplayNoDialogs
docRef.Close psDoNotSaveChanges