On Nov 22, 11:32 am, News123 <news...@free.fr> wrote: > Hi, > > I'm trying to scan a document from a python 2.6 script without user > interaction. > > I found a code snippet, that allows me to scan under Vista, but that > doesn't allow me to select the dpi / color mode / etc. > > The snippet uses win32com.client
Hello, I would also like to know the answer for which i am investigating now, although like yourself i don't know much about the windows API and the MSDN docs aren't helping much :(. All i can understand is that doing anything in windows is a real PITA! I am sure someone (or many) have climbed this mountain before but all of them seemed to have forgotten to leave us the map that shows the easy way up... bummer! The PyWin32extensions are great but lacking detailed information of how to use the thing. And i know some GUI kits like wxPython have Printer support but thats not really what i am talking about here. I want the functionality directly from Python with only win32extentions needed! We need to extend on the great work of PyWin32 *OR* create a new module that will be an abstraction of the Win32 module. The problem with Windows scripting is all the crap you need to do before you can even set parameters. Get a device context or find some cryptic dispatch code, then mull over some even more cryptic options and such. By now your eyeballs are about to pop out of there sockets and your head is ponding from a massive hemorrhage and yet you still have nothing to show for all this jumping through MS hoops!!! There needs to be a drive to make some docs and post them somewhere. This knowledge must be shared! The best place would be in the PyWin32 docs, but i don't expect the creator will do this, he has given us the vehicle now we must forge the path. I am willing to help create this if someone with even a small amount of win32 knowledge could lend their expertise (any takers? send me an email!). I would write all the Python code to implement these actions very easily. (of course i'm not promising ground breaking code here just something that works, but a hack is better than nothing! I think a good start would be two classes for dealing with Printers and Scanners in a very pythonic way (no device contexts!!!), from there the sky is the limit! ##PRINTING RAW STRING## import win32printer printer = win32printer.get_default() if not printer.online(): showerror('', 'Turn it on first you idiot!') sys.exit(1) printer.options.update({ 'orientation':'landscape', 'font':('Times New', 12), 'header':time.ctime(), }) printer.print_raw_string('hello printer, i have have arrived!') ##SCANNING## import win32scanner scanner = win32scanner.get_default() if not scanner.online(): showerror('', 'Turn it on first you idiot!') sys.exit(1) scanner.options['imagetype'] = '.jpg' scanner.scan(file="C:\\tmp\\image1") ##MORE??## All the device context and cryptic mumbo-gumbo are nicly hidden from the user. Of course there will also be option to show dialogs for user input because that will be needed. With this proposed module the bumbling confusion can be avoided. Joe-Scripter can study the source later to learn Win32 more in depth. Yes people i hate windows too, but for now we all have to deal with Windows like it or not! -- http://mail.python.org/mailman/listinfo/python-list