set exportfolderpath to (path to desktop) as text
tell application "Adobe InDesign CS3"
activate
set inddoc to object reference of document 1
end tell
my export2jpgs(inddoc, exportfolderpath)
on export2jpgs(inddoc, exportfolderpath)
tell application "Adobe InDesign CS3"
set jpegprefs to JPEG export preferences
tell jpegprefs
set resolution to 72
set JPEG Quality to maximum
set JPEG export range to export range
set JPEG Rendering style to baseline encoding
end tell
set pagenum to 1
repeat with inddocpage in object reference of every page of inddoc
set Page String of jpegprefs to (pagenum as text)
export inddoc format JPG to (exportfolderpath & pagenum & ".jpg")
set pagenum to pagenum + 1
end repeat
end tell
end export2jpgs