Check if QuickTime is installed
thomas_braun
// 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
// 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
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
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.
May 30, 2012 at 10:28 am - Permalink
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.June 4, 2012 at 01:52 pm - Permalink