You are here

Pass environment variable to portable firefox

10 posts / 0 new
Last post
carlf
Offline
Last seen: 15 years 10 months ago
Joined: 2009-01-31 15:52
Pass environment variable to portable firefox

I like to use vimperator with firefox. Unfortunately, they expect a config file in the user folder. That can be overridden by setting an environment variable on startup. Is the PA wrapper able to pass arbitrary environment variables? Is there some other way to get it to work?

Thanks,
Carl Flippin

John T. Haller
John T. Haller's picture
Online
Last seen: 16 min 20 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Yes

Any environment variable you pass to FirefoxPortable.exe will be passed to firefox.exe and to whatever it launches.

Sometimes, the impossible can become possible, if you're awesome!

carlf
Offline
Last seen: 15 years 10 months ago
Joined: 2009-01-31 15:52
I understand that. I guess

I understand that. I guess I'm asking how I would pass an environment variable when I am launching from the PAM. I tried making a batch file and putting it in like a foreign application but it does not show up. Is there a standard way to get an environment variable passed in?

MaienM
Offline
Last seen: 2 years 8 months ago
Developer
Joined: 2007-12-18 04:35
Convert the BAT to an EXE

As far as I am aware, there is no standard way to do this.
However, you could convert the BAT to an EXE, http://www.google.nl/search?q=bat+to+exe
This will not hide the firefox original icon though, however you could make it like this:

Root of your drive
-- Portableapps
---- Firefox
------ The converted bat
------ The originial FirefoxPortable Directory
---- ...
-- ...

Behold, the DutchLander has arrived.
Grammatical errors are copyrighted.

david_pi
Offline
Last seen: 1 year 10 months ago
Joined: 2011-03-19 09:44
Could I public the VimperatorPortable link here?

I have made a modification of current Firefox Portable.
Add some codes to make Vimperator fully portable.
Using set environment way.
And add a line to set vimperator directory in ${NAME}.ini.
And add a feature to import local vimperator config.

I think Firefox Portable is under GNU so this is legal.
Could I public the link here?

Regards,
David

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Which variable?

Out of interest, what is the variable that it uses? $HOME?

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

david_pi
Offline
Last seen: 1 year 10 months ago
Joined: 2011-03-19 09:44
Yes, it seems $HOME works

Yes, it seems $HOME works well.
Put this before LaunchNow:


VimperatorEnvironment:
System::Call 'Kernel32::SetEnvironmentVariable(t, t) i("HOME", "$VIMPERATORDIRECTORY").r0'

Biggrin

BungieCord
Offline
Last seen: 5 years 7 months ago
Joined: 2009-03-12 16:11
SETLOCAL will do it

I start the PAM with a batch file that contains the "setlocal" command. All the environmental parameters set after that command get passed to all descendant shells and child processes, unless you run the "endlocal" command. From my batch file:

@ECHO off
SETLOCAL EnableExtensions
FOR /F "Tokens=*" %%D In ('CD') Do Set CD=%%D
START %CD%"PortableApps"\"PortableApps.com"\PortableAppsPlatform.exe

I have Command Line Portable installed in my PAM from which I can run the "set" command and confirm that all the parameters that are set in the batch file that starts PAM are indeed being passed to the CLP shell.

More on setlocal: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs...

If you don't want this parameter to affect everything PAM runs, you also can start FFP with a batch file of its own and pass the parameters just to its shell.

There's a file named FirefoxPortable.ini in the directory: \PortableApps\FirefoxPortable\Other\Source. Copy that file into the directory \PortableApps\FirefoxPortable, where the file FirefoxPortable.exe is. The .ini file is ignored unless it happens to be in this directory. Edit the line in the .ini that reads FirefoxExecutable=firefox.exe and change the "firefox.exe" to match the name of your batch file. Put the batch file in the directory: \PortableApps\FirefoxPortable\App\Firefox, along with the firefox.exe. Include the command after setting your environmental parameter to start firefox.exe.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Huh?

I can't comprehend what you're trying to do. You're taking an extraordinarily circuitous route to do what is already supported.

The environment variable "CD" is already set. You can just do this to run it:

"%cd%\PortableApps\PortableApps.com\PortableAppsPlatform.exe"

And as for passing environment variables, you just set it and it will go through. setlocal is for not doing that.

Besides all that, I can't work out how this is at all relevant to the discussion.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

BungieCord
Offline
Last seen: 5 years 7 months ago
Joined: 2009-03-12 16:11
Then I was mistaken. Thank

Then I was mistaken. Thank you for educating me.

Log in or register to post comments