Get Mozilla Plugin Path: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added category links.)
m (Adding new author and category links.)
Line 1: Line 1:
{|align=right
{{PageAuthor|Zunk}}
|<small>Author: [[{{ns:2}}:Zunk|Zunk]] ([[{{ns:3}}:Zunk|talk]], [[{{ns:-1}}:Contributions/Zunk|contrib]])</small>
 
|}
<br style="clear:both;">
== How To Use ==
== How To Use ==
{|
{|
Line 64: Line 62:
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]]
[[Category:Other Products Version Detection Functions]]

Revision as of 12:19, 24 June 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