Get Macromedia Flash version 2

From NSIS Wiki
Jump to navigationJump to search

Use

    Call GetFlashVER
    Pop $R0
    #Messagebox MB_OK "Returned value of FlashVer is [$R0]"
    IntCmp 9 $R0 Flash_Ok Flash_Ok Flash_NotOk
 
#Set a flag to install flash    
Flash_NotOk: 
    IntOp $0 ${SF_SELECTED} | ${SF_RO}
    SectionSetFlags ${InstallFlash} $0
 
Flash_Ok:
    # don't need to to anything here.

The Script

Note that I'm using the GetFileExt function to find the version # which is at the end of the CurVer string.

Function GetFlashVER
    Push $R0
    ClearErrors
    ReadRegStr $R0 HKLM "SOFTWARE\Classes\ShockwaveFlash.ShockwaveFlash\CurVer" ""
    #Messagebox MB_OK "CurVer of Flash [$R0]"
 
    IfErrors LBL_NOFLASH
 
    # Use 'GetFileExt' to find the version number (and hope Adobe keeps increamenting it lineraly as a number)
    Push $R0
    Call GetFileExt
    Pop $R0
    Goto LBL_END
 
 
 
LBL_NOFLASH:
    StrCpy $R0 "0"        # Set the value to zero
 
LBL_END:
    Exch $R0
FunctionEnd