Audio Track
Can I somehow check with my installer if audio track exist on cd?
24 posts
Originally posted by Napek
i want installer to check if data track exist
Originally posted by NapekJust use MCI to check how many tracks exist on the CD. If only one track exists on it then the CD has been improperly copied, because there are no audio tracks.
I don't want to check for data track
For more mci command see the mci reference at MSDN
Name "nsisext_mci"
OutFile "nsisext_mci.exe"
AutoCloseWindow true
Function .onInit
SetOutPath $TEMP
File nsisext_mci.dll
CallInstDLL nsisext_mci.dll nsisGetFirstCDROMDrive
StrCpy $2 "open $0 type cdaudio alias nsis wait"
StrCpy $1 "status nsis number of tracks wait"
StrCpy $0 "status nsis length track 1"
Push $0
Push $1
Push $2
CallInstDLL nsisext_mci.dll nsisMCISendString
MessageBox MB_OK "Length of track 1: $0"
FunctionEnd
Section
; Rest of the setup...
SectionEnd
Function .onInstSuccess
Delete nsisext_mci.dll
FunctionEnd
~ Florian
Name "nsisext_mci"
OutFile "nsisext_mci.exe"
AutoCloseWindow true
Function .onInit
SetOutPath $TEMP
File nsisext_mci.dll
# getting information from nsisext_mci
# get the first CD-ROM drive
CallInstDLL nsisext_mci.dll nsisGetFirstCDROMDrive
# copy drive to $R0
StrCpy $R0 $0
# do the track thing
StrCpy $1 "open $R0 type cdaudio alias nsis wait"
StrCpy $0 "status nsis number of tracks wait"
Push $0
Push $1
CallInstDLL nsisext_mci.dll nsisMCISendString
MessageBox MB_OK "Number of tracks: $0"
StrCpy $R1 $0
# do the length thing in milliseconds
StrCpy $1 "set nsis time format milliseconds wait"
StrCpy $0 "status nsis length track 1 wait"
Push $0
Push $1
CallInstDLL nsisext_mci.dll nsisMCISendString
MessageBox MB_OK "Length of track 1: $0 ms"
StrCpy $R2 $0
# close the device
StrCpy $0 "close nsis"
Push $0
CallInstDLL nsisext_mci.dll nsisMCISendString
# proove number of tracks
# 18 or what ever your track count is
IntCmp $R1 18 lblTrackOK lblTrackBAD
lblTrackBAD:
MessageBox MB_OK "BAD CD!"
Abort
lblTrackOK:
MessageBox MB_OK "GOOD CD!"
# prove track length
# 321294 or what ever your length of track 1 is (in ms)
IntCmp $R2 321294 lblLengthOK lblLengthBAD
lblLengthBAD:
MessageBox MB_OK "BAD length!"
Abort
lblLengthOK:
MessageBox MB_OK "GOOD length!"
FunctionEnd
Section
; Rest of the setup...
SectionEnd
Function .onInstSuccess
Delete "$TEMP\nsisext_mci.dll"
FunctionEnd
toStrCpy $1 "open $R0 type cdaudio alias nsis wait"
StrCpy $0 "status nsis number of tracks wait"
Push $0
Push $1
CallInstDLL nsisext_mci.dll nsisMCISendString
--Push "status nsis number of tracks wait"
Push "open $R0 type cdaudio alias nsis wait"
CallInstDLL nsisext_mci.dll nsisMCISendString
Lines beginning with ; or # are comments.See http://www.firehose.net/free/nsis/makensis.htm#IntOp for IntOp documentation.