on Export_JPGs(myDoc, the_export_folder)
tell application "Adobe InDesign CS3"
set myJPEG_Prefs to JPEG export preferences
tell myJPEG_Prefs
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 pageCount to count every page of myDoc
tell myDoc
repeat with i from 1 to pageCount
set numb to i & "-" & i as string
tell application "Adobe InDesign CS3"
set JPEG export range of JPEG export preferences to numb -- Script errors on this line
end tell
export format JPG to (the_export_folder & i & ".jpg" as string)
end repeat
end tell
end tell
end Export_JPGs