| 1 |
ninoborges |
8 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
Created by
|
| 4 |
|
|
Emanuel Borges
|
| 5 |
|
|
|
| 6 |
|
|
05.13.07
|
| 7 |
|
|
|
| 8 |
|
|
When Summation creates Briefcases, it assembles the tiffs into <bates> as the foldername and within
|
| 9 |
|
|
1.tif, 2.tif.. 10.tif etc as the pages of that document. You cant just use DII_singlePageKreator.py
|
| 10 |
|
|
because the tiffs will order incorrectly. This prog will specif handle 'briefcases' and will convert
|
| 11 |
|
|
to LFP, since it would probably be that a person needing to use this would not be a Summation user
|
| 12 |
|
|
|
| 13 |
|
|
Important Note: the files NEED to be int-able strings.
|
| 14 |
|
|
|
| 15 |
|
|
DEV NOTE: This is still exporting a dii, since I dont understand LFPs too well yet. You then
|
| 16 |
|
|
convert to a LFP with iconvert. LFPs enumerate each bates for each separate page,
|
| 17 |
|
|
requiring a more complicated program.
|
| 18 |
|
|
|
| 19 |
|
|
"""
|
| 20 |
|
|
|
| 21 |
|
|
import os
|
| 22 |
|
|
|
| 23 |
|
|
def AddEntry(args,dirName, fileNames):
|
| 24 |
|
|
output = open(args[1],'a')
|
| 25 |
|
|
condition = ''
|
| 26 |
|
|
begBates = os.path.split(dirName)[1]
|
| 27 |
|
|
tiffList = []
|
| 28 |
|
|
for file in fileNames:
|
| 29 |
|
|
if os.path.splitext(file)[1].upper() == args[0].upper():
|
| 30 |
|
|
print "Tiff found in this dir: %s\n Processing Dir..."% dirName
|
| 31 |
|
|
condition = 'YES'
|
| 32 |
|
|
tiffList.append(file)
|
| 33 |
|
|
if condition == 'YES':
|
| 34 |
|
|
|
| 35 |
|
|
tempList = []
|
| 36 |
|
|
for item in tiffList:
|
| 37 |
|
|
tempList.append(int(os.path.splitext(item)[0]))
|
| 38 |
|
|
tempList.sort()
|
| 39 |
|
|
tiffList = []
|
| 40 |
|
|
for intItem in tempList:
|
| 41 |
|
|
tiffList.append(str(intItem)+'.TIF')
|
| 42 |
|
|
|
| 43 |
|
|
#begBates = os.path.splitext(tiffList[0])[0]
|
| 44 |
|
|
#endBates = os.path.splitext(tiffList[-1])[0]
|
| 45 |
|
|
pageCount = len(tiffList)
|
| 46 |
|
|
#output.write("\n@C Enddoc# %s\n"% endBates)
|
| 47 |
|
|
output.write("\n@C Pgcount %s\n"% pageCount)
|
| 48 |
|
|
output.write("@T %s\n"% begBates)
|
| 49 |
|
|
output.write("@D @I\n")
|
| 50 |
|
|
for tiff in tiffList:
|
| 51 |
|
|
output.write(dirName.split(args[2])[1] + '\\' + tiff + "\n")
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
|
|
if __name__ == '__main__':
|
| 55 |
|
|
startDir = r"\\ercdis11\M\C_D\76442011\20070511_3"
|
| 56 |
|
|
#startDir = r"\\mwcase01\images2\DUPONT LEAD NATIONAL LEAD\Images\ToDo"
|
| 57 |
|
|
delimeterDir,nul = os.path.split(startDir)
|
| 58 |
|
|
#prefix = ""
|
| 59 |
|
|
extension = ".TIF"
|
| 60 |
|
|
newDII = startDir + r'\newDII.DII'
|
| 61 |
|
|
args = [extension,newDII,delimeterDir]
|
| 62 |
|
|
os.path.walk(startDir,AddEntry,args) |