;+ ; ; @file_comments ; Redirect the content of the graphic window in a postscript, ; by redoing commands in the postscript's environment. ; ; @categories ; utilities ; ; @restrictions ; We use journal which allows to stock commands we pass. ; ; Can break down if some weird commands are passed... ; Comment: we erase Syntax error, Illegal characters, compatible ; with oups, text_box... ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 5/3/1999 ;- ;------------------------------------------------------------ ; We have to close the journal! ;------------------------------------------------------------ if !journal EQ 0 then ras = report('ERROR: The Journal is not open !!') journal ;------------------------------------------------------------ ; we complete the journal ... ;------------------------------------------------------------ ; We recuperate the journal as a vector of string : vectjournal = getfile(myuniquetmpdir+'idlsave.pro') ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] ;------------------------------------------------------------ ; We cut the last line which is \@ps ;------------------------------------------------------------ IF strpos(vectjournal[n_elements(vectjournal)-1],'@ps') ne -1 then $ vectjournal = vectjournal[0:n_elements(vectjournal)-2 ] ;------------------------------------------------------------ ; We correct it if needed... ;------------------------------------------------------------ for i = 0, n_elements(vectjournal)-1 do $ if strpos(vectjournal[i],'text_box' ) EQ -1 then $ vectjournal[i] = strtrim(strcompress(vectjournal[i]), 2) ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] ; if 2 lines are identical... for i = 0, n_elements(vectjournal)-2 do $ if vectjournal[i] EQ vectjournal[i+1] then vectjournal[i] = ' ' ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] ; for i = 0, n_elements(vectjournal)-1 do BEGIN & $ if strpos(vectjournal[i],'oups' ) NE -1 $ OR strpos(vectjournal[i],'Syntax error' ) NE -1 $ OR strpos(vectjournal[i],'Illegal character' ) NE -1 $ then BEGIN vectjournal[i] = ' ' & vectjournal[i-1] = ' ' & endif & endfor ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] for i = 0, n_elements(vectjournal)-1 do BEGIN & $ if strpos(strtrim(vectjournal[i], 1),'retall' ) EQ 0 $ OR strpos(vectjournal[i],'@ps' ) NE -1 $ OR strpos(vectjournal[i],'@oups' ) NE -1 $ OR strpos(vectjournal[i],'@vzoom' ) NE -1 $ OR strpos(vectjournal[i],'help' ) NE -1 $ OR strpos(vectjournal[i],'print' ) NE -1 $ then vectjournal[i] = ' ' & endfor ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] for i = 0, n_elements(vectjournal)-1 do BEGIN & $ if strpos(strtrim(vectjournal[i], 1),'plt' ) NE -1 THEN BEGIN & $ if strpos(strtrim(vectjournal[i], 1),'noerase') NE -1 then $ vectjournal[i] = chkeywd(vectjournal[i],'noerase',1) ELSE $ vectjournal[i] = vectjournal[i]+',/noerase' & $ ENDIF & endfor ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] for i = 0, n_elements(vectjournal)-1 do BEGIN & $ if strpos(vectjournal[i],'text_box' ) NE -1 then $ IF strpos(vectjournal[i],',pos=' ) EQ -1 then $ vectjournal[i] = vectjournal[i]+strmid(vectjournal[i+1], 1) & endfor ; We complete it to transform it in a procedure equivalent to plein2dessin vectjournal = ['openps, infowidget= infowidget' $ , vectjournal $ ,'closeps, infowidget= infowidget' $ ,'printps' ] ; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i] ; We rewrite idlsave.pro putfile, myuniquetmpdir+'idlsave.pro', vectjournal ; update the list of .pro and .sav in !PATH path_cache, /rebuild ; apply idlsave @idlsave ; We reopen the journal and we put in it all elements of vectjournal but the 2 first and the 3 last line. journal, myuniquetmpdir+'idlsave.pro' for i = 2, n_elements(vectjournal)-3 DO $ printf, !journal, vectjournal[i]