I need to convert a .csv output into a string of keystrokes for a different program to perform automated billing. For the most part it would work if I only had to automate 4 at a time. That's the output from the regOutput() function. The software that actually functions as the POS has a quirk about advancing to the next page halfway through editing the 5th entry. So the pageChange() function needs to be what prints for every 5th row. so in the print function "P1" needs to be advanced to P2 for the tenth row, P3 for the 15th etc. and "5 CL" needs to advance to "10 CL" "15 CL" etc. also.
So I need to have that function run every five rows of the csv, and add. regOutput() can run for every row not divisible by 5.
So far i have this:
import csv
import sys
export = csv.DictReader(open("export.csv"),delimiter='\t')
sys.stdout = open('autobilling.txt','w')
def regOutput():
for row in export:
print row['SKU']
print row['Qty']
print ' '
print ' '
print 'A'
print 'P'
print row['productPriceSingle']
print 'CL'
print row['Order Store ID']
def pageChange():
for row in export:
print row['SKU']
print row['Qty']
print ' '
print ' '
print 'A'
print 'P'
print row['productPriceSingle']
print ' '
print 'P1'
print 'M'
print '5 CL'
print row['Order Store ID']
print ' '
print 'A'
All help is appreciated. Thanks. Corey