ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Print_It_All.py
Revision: 8
Committed: Sat May 5 04:21:19 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 1519 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 8 ## Print_It_All.py
2     ## This program will take a directory and print everything in that directory and its sub-directories preserving
3     ## and printing the dir name and file name.
4     ## 02.18.04
5     ## EBorges
6    
7     ## This is the command that will do the actuall printing (Page 536 of hammond)
8     # ShellExecute(0,'print','C:\\test_dir\\test.jpg','None','C:\\test_dir',1)
9     ## This will print anything that allows right-click printing. Ie. not tiffs if their assoc with some weird thing.
10     ## If it prints when you right click it and select print this should work.
11    
12     import os,win32ui,win32api,time
13    
14     def PrintTheseFiles(arg, dirname, names):
15     #print arg
16     print "This is the dir name: %s"% dirname
17     dc = win32ui.CreateDC()
18     dc.CreatePrinterDC()
19     dc.StartDoc('Printing Dir name')
20     dc.StartPage()
21     dc.TextOut(100,100,dirname)
22     dc.EndPage()
23     dc.EndDoc()
24     for name in names:
25     if os.path.isfile(dirname + "\\" + name):
26     print "This is the file name: %s"% name
27     dc = win32ui.CreateDC()
28     dc.CreatePrinterDC()
29     dc.StartDoc('Printing File name')
30     dc.StartPage()
31     dc.TextOut(100,100,name)
32     dc.EndPage()
33     dc.EndDoc()
34     code = win32api.ShellExecute(0,'print',dirname + "\\" + name,'None',dirname,0)
35     time.sleep(60)
36    
37    
38    
39     if __name__=='__main__':
40     startDir = r"C:\test_dir\temp\South River Mercury Disk"
41     os.path.walk(startDir,PrintTheseFiles,'crap')