Get Mozilla Plugin Path: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
m (Added category links.)
Line 63: Line 63:


Got started with help from [http://nsis.sourceforge.net/archive/viewpage.php?pageid=307 Check for a Registry Key] by Vytautas
Got started with help from [http://nsis.sourceforge.net/archive/viewpage.php?pageid=307 Check for a Registry Key] by Vytautas
[[{{ns:14}}:Other Products Version Detection Functions]]

Revision as of 21:54, 30 April 2005

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 Check for a Registry Key by Vytautas