'------------------------------------------------------------------------------------------------------------ ' script to create autosave files on report data received ' sometimes more than one report is output and these need separate files ' filename is created from report name and data time stamp in data. ' LOMA CHECKWEIGHER is a unique identifier for the end of a report s=GetIOLine note("Received " & Global1 & " lines") if Global1>linecount then Global1 = linecount end if Global1=Global1+1 'currentlinenum variable not working the same as in Designer when compiled so using Global1 to keep track of position if Global3 = 0 then u=instr(s,"====") if u>0 then 'set start line for data Global2=Global1 end if end if if Global2 > 0 then u=instr(s,"LOMA CHECKWEIGHER") if u>0 then 'set stop line for data Global3=Global1 end if ' end if if Global2>0 then if Global3>0 then Rep=trim(getline(Global3-2)) 'get report name Dat=trim(getline(Global3-4)) 'get date&Time stamp from data Filenam = Rep & " - " & Dat Filenam=replace(Filenam,":","-") ' remove colons from filename ' Path=DefaultSaveDir Path="c:\AAA\" Ext=DefaultExt if Ext=".*" then Ext="" end if createfile(Path+Filenam+Ext) for i = Global2 to Global3-1 t= Getline(i) writetofile(t) next writetofile("| LOMA CHECKWEIGHER |") 'these lines have not arrived in the editor yet so add manually writetofile("---------------------------------------") closefile Global2=0 Global3=0 end if end if '-----------------------------------------------------------------------------------------------------