Check if QuickTime is installed

// Returns 1 if quickTime is present and 0 if not
// It achieves this by trying to save a image as BMP which is only possible with quicktime installed
Function IsQuickTimeInstalled()

    variable err
    string errMsg
   
    // save current debugger state
    variable debuggerState, debugOnError, waveChecking
    DebuggerOptions
    debuggerState = V_enable
    debugOnError  = V_debugOnError
    waveChecking = V_NVAR_SVAR_WAVE_Checking
    // turn debugger off
    DebuggerOptions enable=0

    Make/FREE/N=(1,1) testImage
    NewPath/Q/O tempPath, SpecialDirPath("Temporary",0,0,0)

    err = GetRTError(0)
    ImageSave/P=tempPath/O testImage as "delete_me.bmp"
    errMsg = StringFromList(1,GetRTErrMessage())
    err = GetRTError(1)

    KillPath/Z tempPath

    // restore debugger state
    DebuggerOptions enable=debuggerState, debugOnError=debugOnError, NVAR_SVAR_WAVE_Checking=waveChecking

    if( err == 0 ) // quicktime found
        return 1
    else // err == 221 denotes that quicktime was not found, or other unknown error
        return 0
    endif
End
Would a somewhat simpler method based on ImageFileInfo work?

Help Files wrote:
ImageFileInfo [/P=pathName] fileNameStr
The ImageFileInfo operation supplies information about an image file without having to open the file and load the data into Igor.
ImageFileInfo works with the following file types: PICT, TIFF, GIF, JPEG, PNG, Targa, QuickTime, and BMP.
ImageFileInfo requires QuickTime. The operation will fail (V_flag=0) if you request information for a file format that is not supported by QuickTime.


I suppose it depends on whether V_flag=0 is returned only for unsupported file types (and not for other reasons). Otherwise you would have to depend on a specific RTE error code being detected. It is too inconvenient for me to uninstall QuickTime to test this, so I rely on others for comments.
Thanks for the pointer Stephen.

ImageFileInfo "throws" the same RTE if quicktime is not installed. So the whole GetRTError() and debugger state magic is the same. Additionally one has to have a known image file on disc for ImageFileInfo to work. And getting this to work both on Win and MacOSX would be equally ugly I guess.

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More