FUNCTION countchr,instring,char bstring=BYTE(instring) bchar=BYTE(char) w=WHERE(bstring EQ bchar(0),nw) RETURN,nw END PRO disptitl,wtitle,csz,image_height,psres ; Set up OS-dependent parameters. @isitdos ; Definitions compass_width=0.75*csz*6*!D.X_CH_SIZE timestamp_width=0.75*csz*11*!D.X_CH_SIZE ; How much space reserved for compass and time stamp? width_avail=!D.X_SIZE-timestamp_width-timestamp_width ; Take all available space at the top for the labels. height_avail=!D.Y_SIZE-image_height ; Make all lines of title the same length nt=N_ELEMENTS(wtitle) title_length=INTARR(nt) FOR i=0,nt-1 DO title_length(i)=STRLEN(wtitle(i))-2*countchr(wtitle(i),'!') mtl=MAX(title_length) FOR i=0,nt-1 DO BEGIN d=mtl-title_length(i) df=d/2 wtitle(i)=spc(df)+wtitle(i)+spc(d-df) ENDFOR ; Determine character size to use for title major=((1.*width_avail)/(mtl*csz*!D.X_CH_SIZE))<2 ; Write each line of title into a box x1=timestamp_width x2=!D.X_SIZE-timestamp_width per_line=height_avail/nt FOR i=0,nt-1 DO BEGIN y1=image_height+(nt-i-1)*per_line y2=y1+per_line write_in_box,x1,x2,y1,y2,wtitle(i) $ ,/device,maxcharsize=major*csz,/thick ENDFOR ; get user's name and display it IF dos THEN username='CNSR3' ELSE SPAWN,'whoami',username XYOUTS,scl(res=psres,!D.X_SIZE-timestamp_width) $ ,scl(res=psres,!D.Y_SIZE-3.9*0.75*csz*!D.Y_CH_SIZE) $ ,'User '+STRUPCASE(username) $ ,ALIGNMENT=0,/DEVICE,CHARSIZE=0.75*csz,CHARTHICK=0.75*csz ; get date/time and display them IF dos THEN datetime=SYSTIME() ELSE SPAWN,'date -u',datetime XYOUTS,scl(res=psres,!D.X_SIZE-timestamp_width) $ ,scl(res=psres,!D.Y_SIZE-2.5*0.75*csz*!D.Y_CH_SIZE) $ ,STRMID(datetime,11,9)+' UT' $ ,ALIGNMENT=0,/DEVICE,CHARSIZE=0.75*csz,CHARTHICK=0.75*csz XYOUTS,scl(res=psres,!D.X_SIZE-timestamp_width) $ ,scl(res=psres,!D.Y_SIZE-1.1*0.75*csz*!D.Y_CH_SIZE) $ ,STRMID(datetime,4,7)+STRMID(datetime,24,4) $ ,ALIGNMENT=0,/DEVICE,CHARSIZE=0.75*csz,CHARTHICK=0.75*csz RETURN END