!File: CopyData.mac ! !8/98 ! !Macros: CopyData, Config_Copy, CheckMakePaths ! !Comments: This macro is a CONTRIBUTED UTILITY to be used for the purpose !of copying data files acquired on HP MS ChemStation systems (revision G1034C or !higher) to networked or secondary drives. ! !The remote file system MUST have directories created for the file transfer before !the configuration process will allow destination selection. The directories MUST !be named with a .NET extent (i.e. msd1.net, gcfid3.net, etc.). Once the destination !directories have been created, use the ConfigCopy macro to select them for use !with the instrument. From the command line in TOP, type the following: ! ! macro "copydata.mac" ! ConfigCopy ! !Follow the prompts on the screen to select the destination for data files. This !will allow multiple instruments to share the same drive and store the data in !individual directories. ! !To automate the file transfer, edit your Method and add the following !command in the Method Information Post-Run Macro/Command field: ! ! macro "copydata.mac",go ! !This macro emulates the Unix-style file transfer recognized by the G1701BA !Report Manager. Automated processing can be obtained by configuring a G1701BA !MS ChemStation Report Manager to use the UNIX monitor on the directory where !the data files have been processed. The ChemStation running the Report Manager !MUST have a correct method with the same name as the method that collected the !data on the originating ChemStation. name CheckMakePaths parameter what$ byname foo$,OKToGo byname foo local a,done,temp1$,temp2$,fvals on error done = 1 temp1$ = what$ while done = 0 !parse forward and check each path a = instr(temp1$,"\") if a = 0 if len(temp1$) > 8 temp1$ = temp1$[1:8] endif temp2$ = temp2$+temp1$ what$ = temp2$ done = 1 else if a > 9 temp2$ =temp2$+temp1$[1:8] else temp2$ = temp2$+temp1$[1:a-1] endif fvals = filestat(temp2$) if fvals[7] = 0 if len(temp2$) > 3 !past root mkdir temp2$ endif else if fvals[7] = 1 alert "Specified transfer path "+temp2$+" is a FILE and cannot be used!" done = 1 endif endif temp2$ = temp2$ + "\" temp1$ = temp1$[a+1:len(temp1$)] endif endwhile fvals = filestat(temp2$) if fvals[7] = 0 if len(temp2$) > 3 !past root mkdir temp2$ OKToGo = 1 endif else if fvals[7] = 1 alert "Specified transfer path "+temp2$+" is a FILE and cannot be used!" else !already created directory OKToGo = 1 endif endif return name ConfigCopy local inifile$,inisect$,title$,destp$,destd$,fvals,done inifile$=_instpath$+"dcopy.ini" inisect$="destination" destp$=getinistring$(inifile$,inisect$,"path") destd$=getinistring$(inifile$,inisect$,"directory") title$="Select path for File Transfer" selectfile 2,title$,"*.net",destp$,destd$,exists if _button = 0 !cancelled print "File Transfer configuration cancelled" return endif setinistring(inifile$,inisect$,"path",destp$) setinistring(inifile$,inisect$,"directory",destd$) alert "Create Report Manager file?",4 if _button = 1 setinistring(inifile$,inisect$,"Use RPTMGR","1") else setinistring(inifile$,inisect$,"Use RPTMGR","0") endif OKToGo = 1 remove ConfigCopy return name CopyData parameter what$ def _datapath$+_datafile$,dest$ def "" local inifile$,inisect$,fvals,temp$,a,whatdata$,destp$,destd$,UseRPTMgr inifile$=_instpath$+"dcopy.ini" inisect$="destination" if len(dest$) = 0 !get config'd destination destp$=getinistring$(inifile$,inisect$,"path") destd$=getinistring$(inifile$,inisect$,"directory") UseRPTMgr=getiniint(inifile$,inisect$,"Use RPTMGR") if len(destp$)=0!not configured if check("macro","RunSequence") = 0 !not running sequence print "No destination configured. Running the ConfigCopy utility!" ConfigCopy if OKToGo = 0 return endif else !log it in sequence.log and stop here SeqLogWrite "attempt to transfer data FAILED: not configured" return endif endif dest$ = destp$+destd$ endif fvals = filestat(destp$+destd$) if fvals[7] <> 2 print "Destination "+dest$+" is NOT a direcory or not available!!" remove CheckMakePaths,ConfigCopy,CopyData return endif if eqstr(dest$[len(dest$):len(dest$)],"\") = 1 dest$ = dest$[1:len(dest$)-1] endif fvals=filestat(what$) if fvals[7] <> 2 ! print what$+" is NOT a Data directory" else !parse back to get .d a=len(what$) while a > 0 and (eqstr(what$[a:a],"\"))=0 a = a-1 endwhile whatdata$ = what$[a+1:len(what$)] if UseRPTMgr = 1 !add the ReportManager stuff to pre_post.ini setinistring(what$+"\pre_post.ini","postrun","RptMethod",_methfile$) copy what$+"\pre_post.ini",dest$+"\"+whatdata$[1:len(whatdata$)-1]+"UNX",dontask endif copy what$,dest$+"\"+whatdata$,dontask endif !remove ConfigCopy,CheckMakePaths,CopyData return