/* ----------------------------------------------------------------- Description: Altering the printer for every report on different installations is tedious. chooseprinter() offers full choice but at times speed is of essence. Get_printer.prg program captures the normally required parameters and save them to an ini file passed to it as parameter.This will save color duplex orientation papersize papersource printername Programmers: Akshat Kapoor History: 12 Feb 2019 Sharing the ready to deploy code for the first time. Instantiation/use: Just place get_printer.prg and load_ini in the required directory. get_printer("report1.ini") will save the required parameters in report1.ini (A one time event or as and when required from any form ) When running the report set procedure to report1.rep r = new report1report() load_ini("report1.ini","r.printer") will restore the required defaults. thereafter r.render() No more changing of code. with change of printer. Some Code which I am actually using set procedure to p_sales.rep r = new p_salesreport() r.salesdatamodule1.sales.params["invoice"].value = str(minvoice,10,0) r.salesdatamodule1.sales.params["location"].value = mlocat r.salesdatamodule1.sales.requery() r.title = "Invoice no. "+str(minvoice,10,0) load_ini("cashmemo.ini","r.printer") r.render() Additional requirements : Both load_ini.prg and get_printer.prg are required. They compliment each other. for Any further suggestions please email me akshatkapoor76 at gmail dot com ---------------------------------------------------------------- */ parameters mfile,obj_name infile = new file() if file(mfile) infile.open(mfile) do while not infile.eof() mstr = infile.readln() prop_name = left(mstr,at("[",mstr)-1) prop_value= right(mstr,len(mstr)-at("]",mstr)) prop_type=substr(mstr,at("[",mstr)+1,1) if prop_type = "N" prop_value = val(prop_value) endif if prop_type = "D" prop_value = ctod(prop_value) endif if prop_type = "L" prop_value = iif(upper(prop_value)="TRUE",true,false) endif mvar = obj_name+"."+prop_name &mvar = prop_value enddo endif