; $Id: launch_reflpak.pro,v 1.4 2005/10/13 22:19:28 azuah Exp $
;###############################################################################
;
;FILENAME:
;        launch_reflpak.pro
;
;PURPOSE:
;           The purpose of this program is to launch reflpak files
;           from DAVE.  The effectively incorporates reflectivity
;           analysis into DAVE!!!
;CATEGORY:
;
;
;METHODS IN FILE:
;           launch_reflpak
;
;
; AUTHOR:
; Larry Kneller
; Paul Kienzle
; NIST Center for Neutron Research
; 100 Bureau Drive, Gaithersburg, MD 20899
; United States
; kneller@nist.gov  301-975-8839
; Sep 29, 2005
;
; LICENSE:
; The software in this file is written by an employee of
; National Institute of Standards and Technology
; as part of the DAVE software project.
;
; The DAVE software package is not subject to copyright protection
; and is in the public domain. It should be considered as an
; experimental neutron scattering data reduction, visualization, and
; analysis system. As such, the authors assume no responsibility
; whatsoever for its use, and make no guarantees, expressed or
; implied, about its quality, reliability, or any other
; characteristic. The use of certain trade names or commercial
; products does not imply any endorsement of a particular product,
; nor does it imply that the named product is necessarily the best
; product for the stated purpose. We would appreciate acknowledgment
; if the DAVE software is used of if the code in this file is
; included in another product.
;
;###############################################################################
;

pro launch_reflpak,event

    widget_control,event.id,get_uvalue=val

    case val of
    'reflfit':begin
        arg='fit'
        dir = (*!dave_defaults).workdir
    end;reflfit
    'reflpol':begin
        arg='pol'
        dir = (*!dave_defaults).workdir
    end;reflpol
    'reflred':begin
        arg='red'
        dir = (*!dave_defaults).datdir
    end;reflfit
    else:begin
        void = dialog_message('Unknown reflpak selection <'+val+'>')
        return
    end
    endcase

    path = !dave_dir+path_sep()
    if !version.os eq 'Win32' then begin
        cmd='"'+path+'reflpak.exe" '+arg+' "'+dir
        spawn,cmd,/noshell,/null_stdin,/nowait
    endif else begin
        cmd='"'+path+'reflpak4" '+arg+' "'+dir+'" '
        cmd += ' || "'+path+'reflpak3" '+arg+' "'+dir+'" ' ; required if gcc4 is not installed
        spawn,cmd+' &'
    endelse

;SPAWN [, Command [, Result] [, ErrResult] ]
;
;Keywords (all platforms): [, COUNT=variable] [, EXIT_STATUS=variable] [ ,/NOSHELL] [, /NULL_STDIN] [, PID=variable] [, /STDERR]
;
;UNIX-Only Keywords: [, /NOTTYRESET] [, /SH] [, UNIT=variable {Command required, Result and ErrResult not allowed}]
;
;Windows-Only Keywords: [, /HIDE] [, /LOG_OUTPUT] [, /NOWAIT]


end;launch_reflpak

