Get Mozilla Plugin Path
From NSIS Wiki
Jump to navigationJump to search
Author: Zunk (talk, contrib) |
How To Use
Input: | None |
Output: | String to the plugin dir, or empty |
This is a macro that looks through the HKLM\SOFTWARE\Mozilla registry to find the first entry with information on the plugin dir and put it on the top of the stack.
The Macro
Save as mozillaplugin.nsh in NSIS\Include.
!macro MozillaPluginDir Push $R0 Push $R1 Push $R2 !define Index 'Line${__LINE__}' StrCpy $R1 "0" "${Index}-Loop:" ; Check for Key EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1" StrCmp $R0 "" "${Index}-End" IntOp $R1 $R1 + 1 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins" StrCmp $R2 "" "${Index}-Loop" "${Index}-End" "${Index}-End:" !undef Index Push $R2 Exch 3 Pop $R2 Pop $R1 Pop $R0 !macroend
Example of usage
!include "mozillaplugin.nsh" Section "" !insertmacro MozillaPluginDir Pop $R0 MessageBox MB_OK "$R0" SectionEnd
Got started with help from the page "Check for a Registry Key" by Vytautas.