Plasma Posted April 14, 2006 Share Posted April 14, 2006 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.CheersPlasma Link to comment Share on other sites More sharing options...
WotC Posted April 14, 2006 Share Posted April 14, 2006 (edited) 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 April 14, 2006 by WotC Link to comment Share on other sites More sharing options...
Mikka Posted April 16, 2006 Share Posted April 16, 2006 This one's more flexible:@echo off &setlocal EnableExtensionsFor /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 :EOFFor /f %%x in ('dir /b/on *.xpi 2^>^nul') Do ( Start /wait %Ff% -install-global-extension %%~dpx%%x)endlocalJust 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 More sharing options...
WotC Posted April 17, 2006 Share Posted April 17, 2006 (edited) 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 %Bdoes the job Edited April 17, 2006 by WotC Link to comment Share on other sites More sharing options...
Mikka Posted April 18, 2006 Share Posted April 18, 2006 (edited) 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 April 18, 2006 by Mikka Link to comment Share on other sites More sharing options...
Yzöwl Posted April 18, 2006 Share Posted April 18, 2006 This one's more flexible:@echo off &setlocal EnableExtensionsFor /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 :EOFFor /f %%x in ('dir /b/on *.xpi 2^>^nul') Do ( Start /wait %Ff% -install-global-extension %%~dpx%%x)endlocalNice 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 :EOFNotes:Any lines not beginning with two spaces have line-wrappedOn line 2 `delims=<tab>` Link to comment Share on other sites More sharing options...
Mikka Posted April 19, 2006 Share Posted April 19, 2006 Thanks for the review, Yzöwl, looks promising. Link to comment Share on other sites More sharing options...
WotC Posted April 19, 2006 Share Posted April 19, 2006 (edited) 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 April 19, 2006 by WotC Link to comment Share on other sites More sharing options...
Yzöwl Posted April 19, 2006 Share Posted April 19, 2006 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 More sharing options...
WotC Posted April 19, 2006 Share Posted April 19, 2006 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 More sharing options...
Yzöwl Posted April 19, 2006 Share Posted April 19, 2006 (edited) @ WotCYou 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 :EOFObviously DELIMS=<tab> still.<Edit>noteJust change the stuff inside the parentheses on line 3 to suit your requirements.</Edit> Edited April 19, 2006 by Yzöwl Link to comment Share on other sites More sharing options...
WotC Posted April 21, 2006 Share Posted April 21, 2006 (edited) 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:\Documentsim 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 to2) 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" /fso 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 April 21, 2006 by WotC Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now