Get Mozilla Plugin Path: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library)
 
m (Updated author and download links, and changed format of some pages.)
Line 60: Line 60:
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


Page author: Zunk
Page author: [[User:Zunk|Zunk]]

Revision as of 12:41, 23 April 2005

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

Page author: Zunk