Jump to content

Integrate Firefox Addons / Plugins


Plasma

Recommended Posts

I've got a Cab'd version of Firefox for use with nLite, I'm wanting to integrate a few extensions in the build too. They are all in .XPI format.

Anyone any ideas on how I can manage this? either by integrating them in the Firefox install or as a separate install. If someone can tell me how to do it I'm ok will packing / building the installer my self.

Cheers

Plasma

Link to comment
Share on other sites


if you start if from a *.bat/*.cmd file:

IF EXIST "%programfiles%\Mozilla Firefox\firefox.exe" for %%e in ("%cdrom%\Install\Mozilla_Firefox\*.xpi") do "%programfiles%\Mozilla Firefox\firefox.exe" -install-global-extension "%%e"

if you start it directly from the commandline, replace each %% with %. you can remove the IF EXIST check, too! and of course, adjust the path(s) accordingly!

hope that helps.

Edited by WotC
Link to comment
Share on other sites

This one's more flexible:

@echo off &setlocal EnableExtensions
For /f "tokens=3" %%? in ('reg query "HKLM\SOFTWARE\Mozilla\Mozilla Firefox 1.5\bin" /v PathToExe') Do If errorlevel 0 Set Ff=%%?
If "%Ff%"=="" Goto :EOF
For /f %%x in ('dir /b/on *.xpi 2^>^nul') Do (
Start /wait %Ff% -install-global-extension %%~dpx%%x
)
endlocal

Just throw your extensions in some folder and launch this script, let's call it FfExts.cmd.

Worked fine for me so far.

Link to comment
Share on other sites

nice, indeed. however, i some problems with this script. it sets the %Ff% variable to "c:\program" because it should be "c:\program files". obviously it stops when encountering a space. any solutions?

/edit:

FOR /F "tokens=3*" %A IN ('reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal"') DO SET mydocs=%A %B

does the job

Edited by WotC
Link to comment
Share on other sites

Dаmn it, you're absolutely right: As %ProgramFiles% is set to Programme in my development environment, I didn't take account of the whitespace.

Try this (untested):

[…]
Start /wait "%Ff%" -install-global-extension %%~dpx%%x
[…]

It's merely quick'n dirty, there should be a more elegant solution, though.

Edited by Mikka
Link to comment
Share on other sites

This one's more flexible:

@echo off &setlocal EnableExtensions
For /f "tokens=3" %%? in ('reg query "HKLM\SOFTWARE\Mozilla\Mozilla Firefox 1.5\bin" /v PathToExe') Do If errorlevel 0 Set Ff=%%?
If "%Ff%"=="" Goto :EOF
For /f %%x in ('dir /b/on *.xpi 2^>^nul') Do (
Start /wait %Ff% -install-global-extension %%~dpx%%x
)
endlocal

Nice try Mikka, how's this?
  @ECHO OFF &SETLOCAL ENABLEEXTENSIONS
FOR /F "TOKENS=3 DELIMS= " %%? IN ('REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<PathToExe\>" 2^>NUL') DO (IF ERRORLEVEL 0 (SET FFFP="%%?"))
IF NOT DEFINED FFFP (ENDLOCAL &GOTO :EOF)
FOR /F "DELIMS=" %%? IN ('DIR/B/OD *.XPI ^2^>NUL') DO (IF ERRORLEVEL 0 (START "" /WAIT %FFFP% -INSTALL-GLOBAL-EXTENSION "%%?"))
ENDLOCAL &GOTO :EOF

Notes:

  • Any lines not beginning with two spaces have line-wrapped
    On line 2 `delims=<tab>`

Link to comment
Share on other sites

wow - this is even nicer! i was curious about the version number - but now... can anyone top this? please? PLEASE?!

but again i have the problem with the whitespace, so i need:

FOR /F "TOKENS=3*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<PathToExe\>" 2^>NUL') DO (IF ERRORLEVEL 0 (SET Firefox_Path=%%A %%B))

furthermore i have problems when using a <tab>, thats why i changed to 3* and %%A %%B...

Edited by WotC
Link to comment
Share on other sites

wow - this is even nicer! i was curious about the version number - but now... can anyone top this? please? PLEASE?!

but again i have the problem with the whitespace, so i need:

FOR /F "TOKENS=3*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<PathToExe\>" 2^>NUL') DO (IF ERRORLEVEL 0 (SET Firefox_Path=%%A %%B))

furthermore i have problems when using a <tab>, thats why i changed to 3* and %%A %%B...

There should be no problems with whitespace in my code, both variables used are enclosed within quotes and spaces are not used as delimiters!

As for a tab problem, my only guess is a limitation with your editor and /or chosen font. Try using the attached copy, in order to prevent duplication of that problem.

ffext.zip

Link to comment
Share on other sites

i suppose the problem with the tab was that i tried to copy to a cmd window and the tab got removed :-(

as for the quotes/whitespaces: you are right, it works your way, BUT i wanted to use your command to read out the My Documents path and include e.g. the "My Pictures" path. this, however, is not possible with the quotes, is it?

Link to comment
Share on other sites

@ WotC

You should be able to do that with this!

  @ECHO OFF &SETLOCAL ENABLEEXTENSIONS
FOR /F "TOKENS=3 DELIMS= " %%? IN ('REG QUERY "HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Shell Folders"^|FIND "My Music"') DO (SET USERMM="%%?")
IF DEFINED USERMM (ECHO/Your 'My Music' folder is located at %USERMM%)
ENDLOCAL &GOTO :EOF

Obviously DELIMS=<tab> still.

<Edit>

note

Just change the stuff inside the parentheses on line 3 to suit your requirements.

</Edit>

Edited by Yzöwl
Link to comment
Share on other sites

sorry for not stating this clearly. what i'm doing (after a clean install of windows) is searching for a certain file on harddrives (right now the file Default.rdp, because its more or less common on the computers i'm taking care of) and setting the registry value of HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Shell Folders to that path (i want to change from the Default.rdp file to a certain folder (i.e. Documents), though this is on progress right now). afterwards i want to overwrite the My Music setting in the registry with the same path (just add \My Music), the same with the My Pictures folder,...

so right now i do:

1) the %mydocs% value i get from here:

FOR /F "tokens=3" %%B IN ('ECHO list volume ^| DISKPART.EXE ^| FIND.EXE "Partition"') DO if exist "%%B:\Documents\Default.rdp" SET mydocs=%%B:\Documents

im searching also certain paths containing whitespaces - so if i do a SET mydocs="%%B" i end up with a path (stored as the variable %mydocs%) looking like "E:\User Files\Documents". if i attach a \My Music" to it i end up with "E:\User Files\Documents"\My Music". you see the problem? its not a typo (the quote before the \My). afterwards i want to

2) write the according path of the My Music folder to the registry:

reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Music" /t REG_SZ /d "%mydocs%\My Music" /f

so IF i can do a search for a folder (to clearify: i think the right term would be i need a recursive folder search) some day AND write the path of this folder to the registry (including whitespaces, Music, etc) i would be glad :-)

Edited by WotC
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...