You can initiate exports without anything being selected, but if you truly want to select them, call:
(note: catalog.kAllPhotos is the preferred method for accessing the all-photos collection as of Lr3)
so nice, thanks Rob, but how do I initiate it?
To initiate an export programmatically, just create an lr-export-session object, then call do-export-on-current/new-task.
Thanks, I'll do an experiment on it.